1 /* 2 * ppui/sdl/DisplayDevice_SDL.h 3 * 4 * Copyright 2009 Peter Barth, Dale Whinham 5 * 6 * This file is part of Milkytracker. 7 * 8 * Milkytracker is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * Milkytracker is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with Milkytracker. If not, see <http://www.gnu.org/licenses/>. 20 * 21 */ 22 23 ///////////////////////////////////////////////////////////////// 24 // 25 // Our display device 26 // 27 ///////////////////////////////////////////////////////////////// 28 #ifndef __DISPLAYDEVICE_H__ 29 #define __DISPLAYDEVICE_H__ 30 31 #include "BasicTypes.h" 32 #include "DisplayDeviceBase.h" 33 34 #include <SDL.h> 35 #include <SDL_opengl.h> 36 37 typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); 38 39 // Forwards 40 class PPGraphicsAbstract; 41 42 class PPDisplayDevice : public PPDisplayDeviceBase 43 { 44 public: 45 enum Orientations 46 { 47 // Orientations 48 ORIENTATION_NORMAL, 49 ORIENTATION_ROTATE90CCW, 50 ORIENTATION_ROTATE90CW 51 }; 52 53 protected: 54 pp_int32 realWidth, realHeight; 55 SDL_Window* theWindow; 56 Orientations orientation; 57 int drv_index; 58 59 SDL_Window* CreateWindow(pp_int32& w, pp_int32& h, pp_int32& bpp, Uint32 flags); 60 61 // used for rotating coordinates etc. 62 void adjust(pp_int32& x, pp_int32& y); 63 64 // Mouse pointers 65 SDL_Cursor *cursorStandard, *cursorResizeHoriz, *cursorEggtimer, *cursorHand; 66 void initMousePointers(); 67 68 public: 69 PPDisplayDevice(pp_int32 width, 70 pp_int32 height, 71 pp_int32 scaleFactor, 72 pp_int32 bpp, 73 bool fullScreen, 74 Orientations theOrientation = ORIENTATION_NORMAL); 75 76 virtual ~PPDisplayDevice(); 77 78 void transform(pp_int32& x, pp_int32& y); 79 void transformInverse(pp_int32& x, pp_int32& y); 80 void transformInverse(PPRect& r); 81 getOrientation()82 Orientations getOrientation() { return orientation; } 83 84 SDL_Window* getWindow(); 85 86 // ----------------------------- ex. PPWindow ---------------------------- 87 virtual void setTitle(const PPSystemString& title); 88 virtual bool goFullScreen(bool b); 89 virtual PPSize getDisplayResolution() const; 90 virtual void shutDown(); 91 virtual void signalWaitState(bool b, const PPColor& color); 92 virtual void setMouseCursor(MouseCursorTypes type); 93 }; 94 95 #endif 96