| 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 | |
| 19 | #ifndef LNXAPP_H |
| 20 | #define LNXAPP_Hcxx . . $ `linux/lnxapp.h:20:9`! |
| 21 | |
| 22 | #if defined(POSIXcxx . . $ `<built-in>:477:9`!) |
| 23 | #include "linux_fix.h"cxx . . $ `<file>/linux/linux_fix.h`/ |
| 24 | #endif |
| 25 | |
| 26 | // if no-display/input specifier is given, it will use defaults |
| 27 | #define APPFLAG_USESERVICEcxx . . $ `linux/lnxapp.h:27:9`! 0x00000100 // console (run no output/input) |
| 28 | #define APPFLAG_USESVGAcxx . . $ `linux/lnxapp.h:28:9`! 0x00000200 // console (use svgalib for input/output. NOTE: not used in code) |
| 29 | #define APPFLAG_NOMOUSECAPTUREcxx . . $ `linux/lnxapp.h:29:9`! 0x00000400 // don't capture the mouse in x-win |
| 30 | #define APPFLAG_NOSHAREDMEMORYcxx . . $ `linux/lnxapp.h:30:9`! 0x00000800 // force no-shared memory |
| 31 | #define APPFLAG_WINDOWEDMODEcxx . . $ `linux/lnxapp.h:31:9`! 0x00001000 // run in a window |
| 32 | #define APPFLAG_DGAMOUSEcxx . . $ `linux/lnxapp.h:32:9`! 0x00002000 // use DGA for Mouse |
| 33 | |
| 34 | /* Basic Application Linux data types */ |
| 35 | |
| 36 | // This structure is used to retrieve and set |
| 37 | struct tLnxAppInfocxx . . $ tLnxAppInfo# { |
| 38 | unsigned flagscxx . . $ tLnxAppInfo#flags.; // Application Flags |
| 39 | int wnd_xcxx . . $ tLnxAppInfo#wnd_x., wnd_ycxx . . $ tLnxAppInfo#wnd_y., wnd_wcxx . . $ tLnxAppInfo#wnd_w., wnd_hcxx . . $ tLnxAppInfo#wnd_h.; // Window dimensions |
| 40 | }; |
| 41 | |
| 42 | /* Linux Application Object |
| 43 | This object entails initialization and cleanup of all operating system |
| 44 | elements, as well as data that libraries may need to initialize their |
| 45 | systems. |
| 46 | |
| 47 | We also allow the option of setting these handles from outside the Application object. |
| 48 | */ |
| 49 | |
| 50 | /* Callbacks return a 0 if we don't want to call the default action for the message, otherwise return 1 |
| 51 | */ |
| 52 | // typedef int (*tOELnxMsgCallback)(HWnd,unsigned,unsigned,unsigned); |
| 53 | |
| 54 | class oeLnxApplicationcxx . . $ oeLnxApplication# : public oeApplicationcxx . . $ oeApplication# { |
| 55 | bool m_WasCreatedcxx . . $ oeLnxApplication#m_WasCreated.; // Tells us if this app set graphics or not. |
| 56 | void (*m_DeferFunccxx . . $ oeLnxApplication#m_DeferFunc.)(bool idle); // function to call when deffering to OS |
| 57 | static bool os_initializedcxx . . $ oeLnxApplication#os_initialized.; // is the OS check initialized? |
| 58 | static bool first_timecxx . . $ oeLnxApplication#first_time.; // first time init? |
| 59 | public: |
| 60 | // Creates the application object |
| 61 | oeLnxApplicationcxx . . $ oeLnxApplication#oeLnxApplication(cb2f890c2fdad230).(unsigned flags); |
| 62 | // Create object with a premade info |
| 63 | oeLnxApplicationcxx . . $ oeLnxApplication#oeLnxApplication(7c10a581adce9eb2).(tLnxAppInfocxx . . $ tLnxAppInfo# *appinfo); |
| 64 | virtual ~cxx . . $ oeLnxApplication#`~oeLnxApplication`(ced63f7c635d850d).oeLnxApplicationcxx . . $ oeLnxApplication#(); |
| 65 | // initializes the object |
| 66 | virtual void initcxx . . $ oeLnxApplication#init(49f6e7a06ebc5aa8).(); |
| 67 | // Function to retrieve information from object through a platform defined structure. |
| 68 | virtual void get_infocxx . . $ oeLnxApplication#get_info(5d22bdacc48458e8).(void *appinfo); |
| 69 | // defer returns some flags. essentially this function defers program control to OS. |
| 70 | virtual unsigned defercxx . . $ oeLnxApplication#defer(db52760e79bf9054).(); |
| 71 | virtual const char *get_window_namecxx . . $ oeLnxApplication#get_window_name(33a1f659e94feb42).(void); |
| 72 | virtual void clear_windowcxx . . $ oeLnxApplication#clear_window(49f6e7a06ebc5aa8).(void); |
| 73 | // set a function to run when deferring to OS. |
| 74 | virtual void set_defer_handlercxx . . $ oeLnxApplication#set_defer_handler(ea22beb3ee77eebe).(void (*func)(bool isactive)); |
| 75 | // delays app for a certain amount of time |
| 76 | virtual void delaycxx . . $ oeLnxApplication#delay(9364e6e7bff7660).(float secs); |
| 77 | // Sizes the displayable region of the app (the window) |
| 78 | void set_sizeposcxx . . $ oeLnxApplication#set_sizepos(748afa4755bc9595).(int x, int y, int w, int h); |
| 79 | |
| 80 | virtual int flagscxx . . $ oeLnxApplication#flags(455f465bc33b4cdf).(void) const; |
| 81 | |
| 82 | unsigned m_Flagscxx . . $ oeLnxApplication#m_Flags.; |
| 83 | int m_Xcxx . . $ oeLnxApplication#m_X., m_Ycxx . . $ oeLnxApplication#m_Y., m_Wcxx . . $ oeLnxApplication#m_W., m_Hcxx . . $ oeLnxApplication#m_H.; // window dimensions. |
| 84 | private: |
| 85 | void os_initcxx . . $ oeLnxApplication#os_init(49f6e7a06ebc5aa8).(); // initializes OS components. |
| 86 | }; |
| 87 | |
| 88 | #endif |