first steps for sdl2 ( still many compile errors )

This commit is contained in:
titiger
2015-09-29 01:30:28 +02:00
parent c84e7f5443
commit 23ea9f6201
11 changed files with 386 additions and 684 deletions

View File

@@ -220,7 +220,7 @@ string extractExtension(const string& filename);
void getFullscreenVideoModes(vector<ModeInfo> *modeinfos,bool isFullscreen);
void getFullscreenVideoInfo(int &colorBits,int &screenWidth,int &screenHeight,bool isFullscreen);
void changeVideoModeFullScreen(bool value);
void restoreVideoMode(bool exitingApp=false);
void restoreVideoMode(SDL_Window *sdlWindow,bool exitingApp=false);
bool StartsWith(const std::string &str, const std::string &key);
bool EndsWith(const string &str, const string& key);
@@ -241,8 +241,8 @@ off_t getFileSize(string filename);
bool searchAndReplaceTextInFile(string fileName, string findText, string replaceText, bool simulateOnly);
void copyFileTo(string fromFileName, string toFileName);
int getScreenW();
int getScreenH();
//int getScreenW();
//int getScreenH();
void sleep(int millis);

View File

@@ -45,7 +45,7 @@ namespace Shared{ namespace Platform{
class PlatformContextGl {
protected:
SDL_Surface *icon;
SDL_Surface *screen;
SDL_Window *screen;
public:
// Example values:
@@ -69,7 +69,7 @@ public:
virtual void makeCurrent();
virtual void swapBuffers();
SDL_Surface * getScreen() { return screen; }
SDL_Window * getScreen() { return screen; }
DeviceContextHandle getHandle() const { return 0; }
};

View File

@@ -44,8 +44,6 @@ enum MouseButton {
mbLeft,
mbCenter,
mbRight,
mbWheelUp,
mbWheelDown,
mbButtonX1,
mbButtonX2,
@@ -97,6 +95,7 @@ enum WindowStyle{
class Window {
private:
SDL_Window *sdlWindow;
Uint32 lastMouseDown[mbCount];
int lastMouseX[mbCount];
int lastMouseY[mbCount];
@@ -132,7 +131,7 @@ protected:
public:
static bool handleEvent();
static void revertMousePos();
static void revertMousePos(SDL_Window *sdlwindow);
static Vec2i getOldMousePos();
static bool isKeyDown() { return isKeyPressedDown; }
static void setupGraphicsScreen(int depthBits=-1, int stencilBits=-1, bool hardware_acceleration=false, bool fullscreen_anti_aliasing=false);
@@ -142,7 +141,7 @@ public:
static bool isKeyStateModPressed(int mod);
static wchar_t extractLastKeyPressed();
Window();
Window(SDL_Window *sdlWindow);
virtual ~Window();
static void addAllowedKeys(string keyList);
@@ -214,11 +213,12 @@ protected:
private:
/// needed to detect double clicks
void handleMouseDown(SDL_Event event);
void handleMouseWheel(SDL_Event event);
static MouseButton getMouseButton(int sdlButton);
//static char getKey(SDL_keysym keysym, bool skipSpecialKeys=false);
//static char getNormalKey(SDL_keysym keysym,bool skipSpecialKeys=false);
static void toggleFullscreen();
static void toggleFullscreen(SDL_Window *sdlwindow);
static wchar_t convertStringtoSDLKey(const string &value);
};