| 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/ddio_win/ddio_win.h $ |
| 21 | * $Revision: 11 $ |
| 22 | * $Date: 4/09/99 12:02p $ |
| 23 | * $Author: Samir $ |
| 24 | * |
| 25 | * <insert description of file here> |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/ddio_win/ddio_win.h $ |
| 28 | * |
| 29 | * 11 4/09/99 12:02p Samir |
| 30 | * joystick changes (Win32 DirectInput support) |
| 31 | * |
| 32 | * 10 1/25/99 11:02a Samir |
| 33 | * revamped mouse and key controls. |
| 34 | * |
| 35 | * 9 10/15/98 6:48p Samir |
| 36 | * added timer hooks. |
| 37 | * |
| 38 | * 8 6/29/98 6:43p Samir |
| 39 | * Took out GetMsgProc and legacy keyboard variables. |
| 40 | * |
| 41 | * 7 5/08/98 12:54p Samir |
| 42 | * newer unused mouse handler. |
| 43 | * |
| 44 | * 6 3/31/98 12:46p Samir |
| 45 | * keyboard IO system better. uses getmsgproc windows hook. |
| 46 | * |
| 47 | * 5 12/10/97 1:12p Samir |
| 48 | * Use timestamp from DirectInput Key calls. |
| 49 | * |
| 50 | * 4 10/16/97 2:29p Samir |
| 51 | * Changed DirectInput Keyboard to FOREGROUND |
| 52 | * |
| 53 | * 3 8/13/97 3:02p Samir |
| 54 | * A 'cleaner' way to do DirectInput mouse stuff. |
| 55 | * |
| 56 | * 2 8/01/97 7:30p Samir |
| 57 | * Better NT keyboard support. |
| 58 | * |
| 59 | * 7 5/08/97 1:57p Samir |
| 60 | * Moved keys info structure to ddio_common.h |
| 61 | * |
| 62 | * 6 4/16/97 11:32a Samir |
| 63 | * Added z axis support. |
| 64 | * |
| 65 | * 5 1/23/97 2:24p Samir |
| 66 | * Took out ddio_KeyHandler prototype. |
| 67 | * |
| 68 | * $NoKeywords: $ |
| 69 | */ |
| 70 | |
| 71 | #ifndef DDIO_WIN_H |
| 72 | #define DDIO_WIN_H |
| 73 | |
| 74 | #include <cstdint> |
| 75 | #include <windows.h> |
| 76 | #include "pstypes.h" |
| 77 | #include "win/DirectX/dinput.h" |
| 78 | |
| 79 | class oeWin32Application; |
| 80 | |
| 81 | struct dinput_data { |
| 82 | oeWin32Application *app; |
| 83 | HWND hwnd; |
| 84 | LPDIRECTINPUT lpdi; |
| 85 | bool preemptive; |
| 86 | }; |
| 87 | |
| 88 | extern dinput_data DInputData; |
| 89 | extern bool DDIO_init; |
| 90 | extern bool DDIO_preemptive; |
| 91 | |
| 92 | bool ddio_JoyHandler(); |
| 93 | float ddio_TickToSeconds(uint32_t ticks); |
| 94 | |
| 95 | #ifdef _DEBUG |
| 96 | void ddio_DebugMessage(unsigned err, char *fmt, ...); |
| 97 | #define DDIO_MESSAGE(_m) ddio_DebugMessage _m |
| 98 | #else |
| 99 | #define DDIO_MESSAGE(_m) |
| 100 | #endif |
| 101 | |
| 102 | #define MAKE_DDIO_TIME(_ms) ddio_TickToSeconds(_ms) |
| 103 | |
| 104 | // hook in timer function at certain period. returns a handle to this function |
| 105 | DWORD timer_HookFunction(void(CALLBACK *fncptr)(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR), UINT period); |
| 106 | |
| 107 | // clears function from hook list specified by a handle returned from HookFunction |
| 108 | void timer_ReleaseFunction(DWORD func); |
| 109 | |
| 110 | #endif |