| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/renderer/lnxscreenmode.h $ |
| 21 | * $Revision: 1.3 $ |
| 22 | * $Date: 2004/02/09 04:14:52 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * |
| 26 | * |
| 27 | * $Log: lnxscreenmode.h,v $ |
| 28 | * Revision 1.3 2004/02/09 04:14:52 kevinb |
| 29 | * Added newlines to all headers to reduce number of warnings printed |
| 30 | * |
| 31 | * Made some small changes to get everything compiling. |
| 32 | * |
| 33 | * All Ready to merge the 1.5 tree. |
| 34 | * |
| 35 | * Revision 1.2 2000/04/28 20:25:51 icculus |
| 36 | * Updates, cleanups, and SDLification. |
| 37 | * |
| 38 | * Revision 1.1.1.1 2000/04/18 00:00:49 icculus |
| 39 | * initial checkin |
| 40 | * |
| 41 | * |
| 42 | * 3 9/06/99 9:21p Jeff |
| 43 | * lock video mode switching, don't set viewport when restoring (causing a |
| 44 | * bunch of screen garbage) |
| 45 | * |
| 46 | * 2 9/05/99 9:41p Jeff |
| 47 | * first checkin of Linux Screen manager |
| 48 | * |
| 49 | * $NoKeywords: $ |
| 50 | */ |
| 51 | |
| 52 | #ifndef __LNXVIDEOMODE_H__ |
| 53 | #define __LNXVIDEOMODE_H__ |
| 54 | |
| 55 | #if defined(POSIX) |
| 56 | #include "linux_fix.h" |
| 57 | #endif |
| 58 | #include <SDL.h> |
| 59 | |
| 60 | #define MODE_OK 0 |
| 61 | #define MODE_HSYNC 1 /* hsync out of range */ |
| 62 | #define MODE_VSYNC 2 /* vsync out of range */ |
| 63 | #define MODE_BAD 255 /* unspecified reason */ |
| 64 | |
| 65 | class CLnxVideoModes { |
| 66 | public: |
| 67 | CLnxVideoModes(); |
| 68 | ~CLnxVideoModes(); |
| 69 | |
| 70 | bool Init(void); // Display *dpy,int screen); |
| 71 | void RestoreVideoMode(void); |
| 72 | |
| 73 | // bool QueryExtension(Display *dpy); |
| 74 | // void GetModeLine(Display *dpy,int screen,int *dotclock,XF86VidModeModeLine *modeline); |
| 75 | |
| 76 | bool SwitchResolution(int width, int height); |
| 77 | void Lock(bool lock); |
| 78 | |
| 79 | SDL_Rect **getModes(void) { return m_ModeInfoList; } |
| 80 | Uint32 getSDLFlags(void) { return (sdlflags); } |
| 81 | |
| 82 | private: |
| 83 | // bool SwitchToMode(XF86VidModeModeInfo *mode); |
| 84 | bool LoadLibraries(void); |
| 85 | |
| 86 | bool m_Inited; |
| 87 | bool m_VideoResolutionChanged; |
| 88 | int m_NumVideoModes; |
| 89 | // XF86VidModeModeInfo **m_ModeInfoList; |
| 90 | SDL_Rect **m_ModeInfoList; |
| 91 | Uint32 sdlflags; |
| 92 | // Display *m_Display; |
| 93 | // int m_Screen; |
| 94 | }; |
| 95 | |
| 96 | extern CLnxVideoModes LinuxVideoMode; |
| 97 | |
| 98 | #endif |