2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
SDLwindow.h
|
|
|
|
|
|
|
|
(c) 2006 Laurent Carlier <lordheavy@users.sourceforge.net>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2007-12-30 17:41:49 +01:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __SDLWINDOW_H
|
|
|
|
#define __SDLWINDOW_H
|
|
|
|
|
|
|
|
#include "SDL_h.h"
|
|
|
|
#include "SDLcursor.h"
|
|
|
|
|
2009-08-17 20:08:56 +02:00
|
|
|
#include <GL/glx.h>
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
class SDLwindow
|
|
|
|
{
|
|
|
|
public:
|
2009-08-17 20:08:56 +02:00
|
|
|
SDLwindow(void );
|
2007-12-30 17:41:49 +01:00
|
|
|
virtual ~SDLwindow();
|
|
|
|
|
|
|
|
void Show(void );
|
|
|
|
void Close(void );
|
|
|
|
void Refresh();
|
2009-08-17 20:08:56 +02:00
|
|
|
void Select(void );
|
2007-12-30 17:41:49 +01:00
|
|
|
void Clear(Uint32 color = 0);
|
|
|
|
Uint32 Id(void );
|
|
|
|
|
|
|
|
int GetWidth(void );
|
|
|
|
int GetHeight(void );
|
|
|
|
int GetDepth(void );
|
|
|
|
char* GetTitle(void ) { return (hTitle); };
|
2009-08-17 20:08:56 +02:00
|
|
|
SDL_Surface* GetSdlSurface(void ) { return (hSurface); };
|
|
|
|
// SDLcursor* GetCursor(void ) { return (hCursor); }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
void SetX(int );
|
|
|
|
void SetY(int );
|
|
|
|
void SetWidth(int );
|
|
|
|
void SetHeight(int );
|
|
|
|
void SetFullScreen(bool );
|
|
|
|
void SetResizable(bool );
|
|
|
|
void SetTitle(char* );
|
2009-08-17 20:08:56 +02:00
|
|
|
// void SetCursor(SDLcursor *cursor);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
bool IsFullScreen(void ) {return (hFullScreen); };
|
|
|
|
bool IsResizable(void ) { return (hResizable); };
|
|
|
|
bool IsShown(void );
|
|
|
|
|
|
|
|
// events :)
|
|
|
|
virtual void Quit(void ) = 0;
|
|
|
|
virtual void Resize(void ) = 0;
|
|
|
|
virtual void GotFocus(void ) = 0;
|
|
|
|
virtual void LostFocus(void ) = 0;
|
|
|
|
virtual void MouseEnter(void ) = 0;
|
|
|
|
virtual void MouseLeave(void ) = 0;
|
|
|
|
virtual void Update(void ) = 0;
|
|
|
|
virtual void KeyEvent(SDL_KeyboardEvent* , int ) = 0;
|
|
|
|
virtual void MouseButtonEvent(SDL_MouseButtonEvent* ) = 0;
|
|
|
|
virtual void MouseMotionEvent(SDL_MouseMotionEvent* ) = 0;
|
|
|
|
virtual void Open(void ) =0;
|
|
|
|
|
|
|
|
private:
|
2009-08-17 20:08:56 +02:00
|
|
|
SDL_Surface *hSurface;
|
2007-12-30 17:41:49 +01:00
|
|
|
SDLcursor *hCursor;
|
|
|
|
int hX, hY;
|
|
|
|
int hWidth, hHeight;
|
|
|
|
bool hFullScreen;
|
|
|
|
bool hResizable;
|
|
|
|
char* hTitle;
|
2009-08-17 20:08:56 +02:00
|
|
|
// context and drawable (for GlxMakeCurrent)
|
|
|
|
GLXContext hCtx;
|
|
|
|
GLXDrawable hDrw;
|
|
|
|
Display *hDpy;
|
2007-12-30 17:41:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __SDLWINDOW_H */
|
|
|
|
|