| 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/lib/application.h $ |
| 21 | * $Revision: 11 $ |
| 22 | * $Date: 7/28/99 3:29p $ |
| 23 | * $Author: Kevin $ |
| 24 | * |
| 25 | * Generic Application object. Used to pass info to libraries |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/lib/application.h $ |
| 28 | * |
| 29 | * 11 7/28/99 3:29p Kevin |
| 30 | * Macintosh! |
| 31 | * |
| 32 | * 10 4/15/99 1:44a Jeff |
| 33 | * changes for linux compile |
| 34 | * |
| 35 | * 9 10/08/98 7:26p Samir |
| 36 | * changed the prototype for the defer handler callback. |
| 37 | * |
| 38 | * 8 9/14/98 4:03p Samir |
| 39 | * added console support. |
| 40 | * |
| 41 | * 7 3/23/98 8:04p Samir |
| 42 | * defer handler now returns a bool. |
| 43 | * |
| 44 | * 6 2/26/98 1:00p Samir |
| 45 | * Added application activation functions. |
| 46 | * |
| 47 | * 5 2/23/98 4:30p Samir |
| 48 | * added init function to oeApplication. |
| 49 | * |
| 50 | * 4 10/16/97 2:30p Samir |
| 51 | * Added Idle processing. |
| 52 | * |
| 53 | * 3 9/16/97 1:04p Samir |
| 54 | * Added delay function. |
| 55 | * |
| 56 | * 2 7/28/97 3:46p Samir |
| 57 | * Added OEAPP_TOPMOST flag. |
| 58 | * |
| 59 | * 2 6/11/97 2:39p Samir |
| 60 | * Added destructors. |
| 61 | * |
| 62 | * 1 6/10/97 4:55p Samir |
| 63 | * New App object. |
| 64 | * |
| 65 | * $NoKeywords: $ |
| 66 | */ |
| 67 | #ifndef APP_H |
| 68 | #define APP_H |
| 69 | #include "pstypes.h" |
| 70 | /* Basic Application data types */ |
| 71 | /* Application Object |
| 72 | This object entails initialization and cleanup of all operating system |
| 73 | elements, as well as data that libraries may need to initialize their |
| 74 | systems. Look under the specific header file for a platform for information |
| 75 | about what's needed for the target machine. |
| 76 | */ |
| 77 | /* Application flags */ |
| 78 | const int OEAPP_WINDOWED = 1, // App will run in a window. May not be supported. |
| 79 | OEAPP_FULLSCREEN = 2, // App will run in fullscreen. May not be supported. |
| 80 | OEAPP_TOPMOST = 4, // App will be on the topmost display. May not be supported. |
| 81 | OEAPP_CONSOLE = 8; // App will run in a console style window. |
| 82 | class oeApplication { |
| 83 | protected: |
| 84 | bool m_AppActive; |
| 85 | |
| 86 | public: |
| 87 | oeApplication() { m_AppActive = true; }; |
| 88 | virtual ~oeApplication(){}; |
| 89 | // initializes the object |
| 90 | virtual void init() = 0; |
| 91 | // Function to retrieve information from object through a platform defined structure. |
| 92 | virtual void get_info(void *buffer) = 0; |
| 93 | // Function to get the flags |
| 94 | virtual int flags(void) const = 0; |
| 95 | // defer returns some flags. essentially this function defers program control to OS. |
| 96 | virtual unsigned defer() = 0; |
| 97 | // suspends application for a certain amout of time... |
| 98 | virtual void delay(float secs) = 0; |
| 99 | // set a function to run when deferring to OS. |
| 100 | virtual void set_defer_handler(void (*func)(bool)) = 0; |
| 101 | |
| 102 | public: |
| 103 | // checks if the application is active |
| 104 | bool active() const { return m_AppActive; }; |
| 105 | void activate() { m_AppActive = true; }; |
| 106 | void deactivate() { m_AppActive = false; }; |
| 107 | }; |
| 108 | /* This section includes the platform-specific header files |
| 109 | Add a platform to this list once implemented: |
| 110 | Win32 Samir Win32App.h 06/97 |
| 111 | */ |
| 112 | #if defined(DX_APP) |
| 113 | #include "win\win32app.h" |
| 114 | #else |
| 115 | #include "lnxapp.h" |
| 116 | #endif |
| 117 | |
| 118 | #endif // APP_H |