24 #include "C4Version.h"
42 #define C4ViewportClassName L"C4Viewport"
43 #define C4FullScreenClassName L"C4FullScreen"
44 #define ConsoleDlgClassName L"C4GUIdlg"
45 #define ConsoleDlgWindowStyle (WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX)
48 static void ConvertToUnixScancode(WPARAM wParam,
C4KeyCode *scancode,
bool extended)
54 case VK_HOME:
s = K_HOME;
break;
55 case VK_END:
s = K_END;
break;
56 case VK_PRIOR:
s = K_PAGEUP;
break;
57 case VK_NEXT:
s = K_PAGEDOWN;
break;
58 case VK_UP:
s = K_UP;
break;
59 case VK_DOWN:
s = K_DOWN;
break;
60 case VK_LEFT:
s = K_LEFT;
break;
61 case VK_RIGHT:
s = K_RIGHT;
break;
62 case VK_CLEAR:
s = K_CENTER;
break;
63 case VK_INSERT:
s = K_INSERT;
break;
64 case VK_DELETE:
s = K_DELETE;
break;
65 case VK_LWIN:
s = K_WIN_L;
break;
66 case VK_RWIN:
s = K_WIN_R;
break;
67 case VK_MENU:
s = K_MENU;
break;
68 case VK_PAUSE:
s = K_PAUSE;
break;
69 case VK_PRINT:
s = K_PRINT;
break;
70 case VK_RCONTROL:
s = K_CONTROL_R;
break;
71 case VK_CONTROL:
s = (extended ? K_CONTROL_R : K_CONTROL_L);
break;
72 case VK_NUMLOCK:
s = K_NUM;
break;
73 case VK_NUMPAD1:
s = K_NUM1;
break;
74 case VK_NUMPAD2:
s = K_NUM2;
break;
75 case VK_NUMPAD3:
s = K_NUM3;
break;
76 case VK_NUMPAD4:
s = K_NUM4;
break;
77 case VK_NUMPAD5:
s = K_NUM5;
break;
78 case VK_NUMPAD6:
s = K_NUM6;
break;
79 case VK_NUMPAD7:
s = K_NUM7;
break;
80 case VK_NUMPAD8:
s = K_NUM8;
break;
81 case VK_NUMPAD9:
s = K_NUM9;
break;
82 case VK_NUMPAD0:
s = K_NUM0;
break;
88 static bool NativeCursorShown =
true;
95 C4KeyCode scancode = (((
unsigned int)lParam) >> 16) & 0xFF;
96 bool extended = ((lParam & 0x01000000) != 0);
97 ConvertToUnixScancode(wParam, &scancode, extended);
103 wParam = (LOWORD(wParam)==WA_ACTIVE || LOWORD(wParam)==WA_CLICKACTIVE);
122 ::ChangeDisplaySettings(
nullptr, 0);
123 ::ShowWindow(hwnd, SW_MINIMIZE);
148 if (wParam == MCI_NOTIFY_SUCCESSFUL)
152 if (
Game.
DoKeyboardInput(scancode,
KEYEV_Up, !!(lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0,
false,
nullptr))
156 if (
Game.
DoKeyboardInput(scancode,
KEYEV_Down, !!(lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0, !!(lParam & 0x40000000),
nullptr))
160 if (wParam == 18)
break;
161 if (
Game.
DoKeyboardInput(scancode,
KEYEV_Down, !!(lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0, !!(lParam & 0x40000000),
nullptr))
165 PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE);
172 char c[5] = {0,0,0,0,0};
173 if(!WideCharToMultiByte(CP_UTF8, 0L,
reinterpret_cast<LPCWSTR
>(&wParam), 1, c, 4,
nullptr,
nullptr))
181 if (
SEqual2((
const char *)lParam,
"IDS_"))
184 Log((
const char *)lParam);
197 ScreenToClient(hwnd, &p);
203 if (NativeCursorShown)
205 NativeCursorShown =
false;
211 if (!NativeCursorShown)
213 NativeCursorShown =
true;
225 ::SetWindowPos(
Application.
pWindow->renderwnd,
nullptr, 0, 0, p.x, p.y, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOZORDER);
229 case WM_INPUTLANGCHANGE:
236 if ((wParam & 0xFFF0) == SC_KEYMENU && lParam == 0)
240 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
246 C4KeyCode scancode = (((
unsigned int)msg->lParam) >> 16) & 0xFF;
247 bool extended = ((msg->lParam & 0x01000000) != 0);
248 ConvertToUnixScancode(msg->wParam, &scancode, extended);
254 switch (msg->message)
257 if (
Game.
DoKeyboardInput(msg2scancode(msg),
KEYEV_Down, !!(msg->lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0, !!(msg->lParam & 0x40000000),
nullptr))
return true;
260 if (
Game.
DoKeyboardInput(msg2scancode(msg),
KEYEV_Up, !!(msg->lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0,
false,
nullptr))
return false;
263 if (msg->wParam == 18)
break;
264 if (
Game.
DoKeyboardInput(msg2scancode(msg),
KEYEV_Down, !!(msg->lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0, !!(msg->lParam & 0x40000000),
nullptr))
return false;
276 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
279 C4KeyCode scancode = (((
unsigned int)lParam) >> 16) & 0xFF;
280 bool extended = ((lParam & 0x01000000) != 0);
281 ConvertToUnixScancode(wParam, &scancode, extended);
298 if (
Game.
DoKeyboardInput(scancode,
KEYEV_Down, !!(lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0, !!(lParam & 0x40000000),
nullptr))
return 0;
305 if (
Game.
DoKeyboardInput(scancode,
KEYEV_Up, !!(lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0,
false,
nullptr))
return 0;
309 if (wParam == 18)
break;
310 if (
Game.
DoKeyboardInput(scancode,
KEYEV_Down, !!(lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0, !!(lParam & 0x40000000),
nullptr))
return 0;
318 DragAcceptFiles(hwnd, TRUE);
327 HDROP hDrop = (HDROP)(HANDLE) wParam;
330 int32_t iFileNum = DragQueryFile(hDrop,0xFFFFFFFF,
nullptr,0);
332 DragQueryPoint(hDrop,&pntPoint);
333 wchar_t szFilename[500+1];
334 for (int32_t cnt=0; cnt<iFileNum; cnt++)
336 DragQueryFileW(hDrop,cnt,szFilename,500);
337 cvp->
DropFile(
StdStrBuf(szFilename).getData(), (
float)pntPoint.x, (
float)pntPoint.y);
357 switch (LOWORD(wParam))
360 case SB_THUMBPOSITION: cvp->
SetViewX(
float(HIWORD(wParam))/cvp->
Zoom);
break;
371 switch (LOWORD(wParam))
374 case SB_THUMBPOSITION: cvp->
SetViewY(
float(HIWORD(wParam))/cvp->
Zoom);
break;
389 if (LOWORD(wParam) == WA_INACTIVE)
391 Console.Win32KeepDialogsFloating();
396 case WM_MOUSEACTIVATE:
399 Console.Win32KeepDialogsFloating(hwnd);
407 if ((wParam & 0xFFF0) == SC_KEYMENU && lParam == 0)
442 ScreenToClient(hwnd, &p);
455 DWORD dwKeyState = 0;
456 if(GetKeyState(VK_CONTROL) < 0) dwKeyState |= MK_CONTROL;
457 if(GetKeyState(VK_SHIFT) < 0) dwKeyState |= MK_SHIFT;
458 if(GetKeyState(VK_MENU) < 0) dwKeyState |= MK_ALT;
477 cvp->
pWindow->EditCursorMove(p.x, p.y, dwKeyState);
486 case WM_MOUSEMOVE: cvp->
pWindow->EditCursorMove(p.x, p.y, dwKeyState);
break;
491 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
494 LRESULT APIENTRY
DialogWinProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
498 if (!pDlg)
return DefWindowProc(hwnd, uMsg, wParam, lParam);
505 C4KeyCode scancode = (((
unsigned int)lParam) >> 16) & 0xFF;
506 bool extended = ((lParam & 0x01000000) != 0);
507 ConvertToUnixScancode(wParam, &scancode, extended);
514 if (
Game.
DoKeyboardInput(scancode,
KEYEV_Down, !!(lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0, !!(lParam & 0x40000000), pDlg))
return 0;
518 if (
Game.
DoKeyboardInput(scancode,
KEYEV_Up, !!(lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0,
false, pDlg))
return 0;
522 if (wParam == 18)
break;
523 if (
Game.
DoKeyboardInput(scancode,
KEYEV_Down, !!(lParam & 0x20000000), GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_SHIFT) < 0, !!(lParam & 0x40000000), pDlg))
return 0;
528 const char *szID = pDlg->
GetID();
564 ScreenToClient(hwnd, &p);
570 return DefWindowProc(hwnd, uMsg, wParam, lParam);
582 #ifdef WITH_QT_EDITOR
587 static bool fViewportClassRegistered =
false;
588 if (!fViewportClassRegistered)
591 WNDCLASSEXW WndClass;
592 WndClass.cbSize=
sizeof(WNDCLASSEX);
593 WndClass.style = CS_DBLCLKS | CS_BYTEALIGNCLIENT;
595 WndClass.cbClsExtra = 0;
596 WndClass.cbWndExtra = 0;
597 WndClass.hInstance = pApp->GetInstance();
598 WndClass.hCursor = LoadCursor (
nullptr, IDC_ARROW);
599 WndClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
600 WndClass.lpszMenuName =
nullptr;
602 WndClass.hIcon = LoadIcon (pApp->GetInstance(), MAKEINTRESOURCE (
IDI_01_OCS) );
603 WndClass.hIconSm = LoadIcon (pApp->GetInstance(), MAKEINTRESOURCE (
IDI_01_OCS) );
604 if (!RegisterClassExW(&WndClass))
return nullptr;
605 fViewportClassRegistered =
true;
608 hWindow = CreateWindowExW (
611 CW_USEDEFAULT,CW_USEDEFAULT, size->
Wdt, size->
Hgt,
612 Console.hWindow,
nullptr,pApp->GetInstance(),
nullptr);
613 if(!hWindow)
return nullptr;
622 auto WndClass = WNDCLASSEXW();
623 WndClass.cbSize =
sizeof(WNDCLASSEX);
624 WndClass.style = CS_DBLCLKS;
626 WndClass.hInstance = pApp->GetInstance();
627 WndClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
629 WndClass.hIcon = LoadIcon (pApp->GetInstance(), MAKEINTRESOURCE (
IDI_00_C4X) );
630 WndClass.hIconSm = LoadIcon (pApp->GetInstance(), MAKEINTRESOURCE (
IDI_00_C4X) );
631 if (!RegisterClassExW(&WndClass))
return nullptr;
634 hWindow = CreateWindowExW (
639 CW_USEDEFAULT,CW_USEDEFAULT, size->
Wdt, size->
Hgt,
640 nullptr,
nullptr,pApp->GetInstance(),
nullptr);
641 if(!hWindow)
return nullptr;
644 GetClientRect(hWindow, &rc);
645 renderwnd = CreateWindowExW(0, L
"STATIC",
nullptr, WS_CHILD,
646 0, 0, rc.right - rc.left, rc.bottom - rc.top,
647 hWindow,
nullptr, pApp->GetInstance(),
nullptr);
648 if(!renderwnd) { DestroyWindow(hWindow);
return nullptr; }
649 ShowWindow(renderwnd, SW_SHOW);
653 ShowWindow(hWindow,SW_SHOWNORMAL);
659 static bool fDialogClassRegistered =
false;
660 if (!fDialogClassRegistered)
663 WNDCLASSEXW WndClass;
664 WndClass.cbSize=
sizeof(WNDCLASSEX);
665 WndClass.style = CS_DBLCLKS | CS_BYTEALIGNCLIENT;
667 WndClass.cbClsExtra = 0;
668 WndClass.cbWndExtra = 0;
669 WndClass.hInstance = pApp->GetInstance();
670 WndClass.hCursor = LoadCursor (
nullptr, IDC_ARROW);
671 WndClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
672 WndClass.lpszMenuName =
nullptr;
674 WndClass.hIcon = LoadIcon (pApp->GetInstance(), MAKEINTRESOURCE (
IDI_00_C4X) );
675 WndClass.hIconSm = LoadIcon (pApp->GetInstance(), MAKEINTRESOURCE (
IDI_00_C4X) );
676 if (!RegisterClassExW(&WndClass))
684 rtSize.right = size->
Wdt;
685 rtSize.bottom = size->
Hgt;
689 if (!Title || !*Title) Title =
"???";
690 hWindow = ::CreateWindowExW(
694 CW_USEDEFAULT,CW_USEDEFAULT,rtSize.right-rtSize.left,rtSize.bottom-rtSize.top,
695 ::
Console.hWindow,
nullptr,pApp->GetInstance(),
nullptr);
697 return hWindow ? this :
nullptr;
702 hWindow = renderwnd =
nullptr;
716 GetClientRect(hWindow, &rc);
717 HWND hNewRenderWindow = CreateWindowExW(0, L
"STATIC",
nullptr, WS_CHILD,
718 0, 0, rc.right - rc.left, rc.bottom - rc.top,
719 hWindow,
nullptr, pApp->hInstance,
nullptr);
720 if(!hNewRenderWindow)
return false;
722 ShowWindow(hNewRenderWindow, SW_SHOW);
723 DestroyWindow(renderwnd);
724 renderwnd = hNewRenderWindow;
734 if (renderwnd) DestroyWindow(renderwnd);
735 if (hWindow && hWindow != renderwnd) DestroyWindow(hWindow);
737 #ifdef WITH_QT_EDITOR
750 return StoreWindowPosition(hWindow, szWindowName, szSubKey, fStoreSize) != 0;
755 if (!RestoreWindowPosition(hWindow, szWindowName, szSubKey, fHidden))
756 ShowWindow(hWindow,SW_SHOWNORMAL);
762 if (hWindow) SetWindowTextW(hWindow,
GetWideChar(szToTitle ? szToTitle :
""));
768 if (!(hWindow && GetClientRect(hWindow,&r)))
return false;
771 pRect->
Wdt = r.right - r.left;
772 pRect->
Hgt = r.bottom - r.top;
781 RECT rect = { 0, 0,
static_cast<LONG
>(cx),
static_cast<LONG
>(cy) };
782 ::AdjustWindowRectEx(&rect, GetWindowLong(hWindow, GWL_STYLE), FALSE, GetWindowLong(hWindow, GWL_EXSTYLE));
783 cx = rect.right - rect.left;
784 cy = rect.bottom - rect.top;
785 ::SetWindowPos(hWindow,
nullptr, 0, 0, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOZORDER);
788 GetClientRect(hWindow, &rect);
789 ::SetWindowPos(renderwnd,
nullptr, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOZORDER);
815 bool CStdMessageProc::Execute(
int iTimeout, pollfd *)
819 while (PeekMessage(&msg,
nullptr,0,0,PM_REMOVE))
822 if (msg.message == WM_QUIT)
828 if (!pApp->
pWindow || !pApp->
pWindow->Win32DialogMessageHandling(&msg))
830 TranslateMessage(&msg); DispatchMessage(&msg);
840 ZeroMemory(&dspMode,
sizeof(dspMode)); dspMode.dmSize =
sizeof(dspMode);
841 ZeroMemory(&OldDspMode,
sizeof(OldDspMode)); OldDspMode.dmSize =
sizeof(OldDspMode);
844 MessageProc.SetApp(
this);
854 idMainThread = ::GetCurrentThreadId();
856 return DoInit (argc, argv);
876 return MessageProc.Execute(0);
879 void C4AbstractApp::SetLastErrorFromOS()
881 LPWSTR buffer =
nullptr;
882 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
883 nullptr, ::
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
reinterpret_cast<LPWSTR
>(&buffer), 0,
nullptr);
890 static BOOL CALLBACK GLMonitorInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
896 pApp->hMon = hMonitor;
897 pApp->MonitorRect = *lprcMonitor;
905 ZeroMemory(&dmode,
sizeof(dmode)); dmode.dmSize =
sizeof(dmode);
908 Mon.
Format(R
"(\\.\Display%d)", iMonitor+1);
910 if (!EnumDisplaySettingsW(Mon.GetWideChar(), iIndex, &dmode))
912 SetLastErrorFromOS();
916 if (piXRes) *piXRes = dmode.dmPelsWidth;
917 if (piYRes) *piYRes = dmode.dmPelsHeight;
918 if (piBitDepth) *piBitDepth = dmode.dmBitsPerPel;
919 if (piRefreshRate) *piRefreshRate = dmode.dmDisplayFrequency;
930 SetWindowLong(
pWindow->hWindow, GWL_EXSTYLE,
931 GetWindowLong(
pWindow->hWindow, GWL_EXSTYLE) | WS_EX_APPWINDOW);
936 ChangeDisplaySettings(
nullptr, 0);
937 SetWindowLong(
pWindow->hWindow, GWL_STYLE,
938 GetWindowLong(
pWindow->hWindow, GWL_STYLE) | (WS_CAPTION|WS_THICKFRAME|WS_BORDER));
939 if(iXRes != -1 && iYRes != -1) {
943 ::SetWindowPos(
pWindow->hWindow,
nullptr, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_FRAMECHANGED);
953 EnumDisplayMonitors(
nullptr,
nullptr, GLMonitorInfoEnumProc, (LPARAM)
this);
960 MonitorRect.left = MonitorRect.top = 0;
961 MonitorRect.right = iXRes;
962 MonitorRect.bottom = iYRes;
968 Mon.
Format(R
"(\\.\Display%d)", iMonitor+1);
970 ZeroMemory(&dmode, sizeof(dmode));
971 dmode.dmSize =
sizeof(dmode);
974 if (!EnumDisplaySettingsW(Mon.GetWideChar(), ENUM_CURRENT_SETTINGS, &dmode))
976 SetLastErrorFromOS();
979 unsigned long orientation = dmode.dmDisplayOrientation;
980 if (iXRes == -1 && iYRes == -1)
987 if (!fFound)
while (EnumDisplaySettingsW(Mon.GetWideChar(), i++, &dmode))
989 if (
static_cast<int>(dmode.dmPelsWidth) == iXRes &&
static_cast<int>(dmode.dmPelsHeight) == iYRes && dmode.dmBitsPerPel ==
C4Draw::COLOR_DEPTH && dmode.dmDisplayOrientation == orientation
990 && (iRefreshRate == 0 || dmode.dmDisplayFrequency == iRefreshRate))
996 if (!fFound)
return false;
998 dspMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
999 if (iRefreshRate != 0)
1000 dspMode.dmFields |= DM_DISPLAYFREQUENCY;
1001 LONG rv = ChangeDisplaySettingsExW(iMonitor ? Mon.GetWideChar() :
nullptr, &dspMode,
nullptr, CDS_FULLSCREEN,
nullptr);
1002 if (rv != DISP_CHANGE_SUCCESSFUL)
1006 #define CDSE_ERROR(error) case error: sLastError = LoadResStr("IDS_ERR_" #error); break
1020 SetWindowLong(
pWindow->hWindow, GWL_STYLE,
1021 GetWindowLong(
pWindow->hWindow, GWL_STYLE) & ~ (WS_CAPTION|WS_THICKFRAME|WS_BORDER));
1025 ::SetWindowPos(
pWindow->hWindow,
nullptr, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_FRAMECHANGED);
1033 MessageBoxW(
nullptr,
GetWideChar(message),
ADDL(C4ENGINECAPTION), MB_ICONERROR);
1039 if (!fClipboard)
return false;
1040 bool fSuccess =
true;
1042 if (!OpenClipboard(
pWindow ?
pWindow->hWindow :
nullptr))
return false;
1045 int size = MultiByteToWideChar(CP_UTF8, 0,
text.c_str(),
text.size() + 1,
nullptr, 0);
1046 HANDLE hglbCopy = GlobalAlloc(GMEM_MOVEABLE, size *
sizeof(
wchar_t));
1047 if (hglbCopy ==
nullptr) { CloseClipboard();
return false; }
1049 wchar_t *szCopyChar = (
wchar_t *) GlobalLock(hglbCopy);
1050 fSuccess = !!MultiByteToWideChar(CP_UTF8, 0,
text.c_str(),
text.size() + 1, szCopyChar, size);
1051 GlobalUnlock(hglbCopy);
1053 fSuccess = fSuccess && !!SetClipboardData(CF_UNICODETEXT, hglbCopy);
1062 if (!fClipboard)
return std::string();
1064 if (!OpenClipboard(
nullptr))
return std::string();
1066 HANDLE hglb = GetClipboardData(CF_UNICODETEXT);
1067 if (!hglb)
return std::string();
1068 std::string
text{ WStrToString((
wchar_t*)GlobalLock(hglb)) };
1078 if (!fClipboard)
return false;
1079 return !!IsClipboardFormatAvailable(CF_UNICODETEXT);
C4Application Application
C4MouseControl MouseControl
C4GraphicsSystem GraphicsSystem
const char * LoadResStr(const char *id)
bool Log(const char *szMessage)
const int32_t C4MC_Button_None
const int32_t C4MC_Button_RightDown
const int32_t C4MC_Button_RightUp
const int32_t C4MC_Button_RightDouble
const int32_t C4MC_Button_LeftUp
const int32_t C4MC_Button_LeftDown
const int32_t C4MC_Button_LeftDouble
const int32_t C4MC_Button_Wheel
#define C4ViewportWindowStyle
LRESULT APIENTRY ViewportWinProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define ConsoleDlgWindowStyle
#define CDSE_ERROR(error)
bool ConsoleHandleWin32KeyboardMessage(MSG *msg)
#define C4ViewportClassName
LRESULT APIENTRY FullScreenWinProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define ConsoleDlgClassName
LRESULT APIENTRY DialogWinProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define C4FullScreenClassName
int GLMonitorInfoEnumCount
StdStrBuf::wchar_t_holder GetWideChar(const char *utf8, bool double_null_terminate=false)
bool SEqual2(const char *szStr1, const char *szStr2)
StdStrBuf FormatString(const char *szFmt,...)
void MessageDialog(const char *message)
bool SetVideoMode(int iXRes, int iYRes, unsigned int iRefreshRate, unsigned int iMonitor, bool fFullScreen)
bool IsClipboardFull(bool fClipboard=true)
virtual void OnResolutionChanged(unsigned int iXRes, unsigned int iYRes)=0
bool GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)
~C4AbstractApp() override
bool Copy(const std::string &text, bool fClipboard=true)
std::string Paste(bool fClipboard=true)
virtual bool DoInit(int argc, char *argv[])=0
bool Init(int argc, char *argv[])
const char * GetLastError()
void OnKeyboardLayoutChanged() override
C4MusicSystem MusicSystem
void OnResolutionChanged(unsigned int iXRes, unsigned int iYRes) override
const char * GetSubkeyPath(const char *subkey)
C4ConfigGraphics Graphics
void AddViewport(C4ViewportWindow *cvp)
void RemoveViewport(C4ViewportWindow *cvp)
bool Message(const char *szMessage, bool fQuery=false)
static constexpr int COLOR_DEPTH
bool LeftButtonDown(DWORD dwKeyState)
bool KeyDown(C4KeyCode KeyCode, DWORD dwKeyState)
bool RightButtonDown(DWORD dwKeyState)
bool RightButtonUp(DWORD dwKeyState)
bool LeftButtonUp(DWORD dwKeyState)
bool KeyUp(C4KeyCode KeyCode, DWORD dwKeyState)
virtual const char * GetID()
virtual bool CharIn(const char *c)
bool MouseInput(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, Dialog *pDlg, class C4Viewport *pVP)
Dialog * GetDialog(C4Window *pWindow)
bool DoKeyboardInput(C4KeyCode vk_code, C4KeyEventType event_type, bool alt, bool ctrl, bool shift, bool repeated, class C4GUI::Dialog *for_dialog=nullptr, bool fPlrCtrlOnly=false, int32_t strength=-1)
bool DropDef(C4ID id, float x, float y)
bool IsViewport(C4Viewport *pViewport)
bool UpdateOutputSize(int32_t new_width=0, int32_t new_height=0)
std::unique_ptr< C4ViewportWindow > pWindow
bool ScrollBarsByViewPosition()
void ScrollView(float by_x, float by_y)
void DropFile(const char *filename, float x, float y)
C4Viewport * GetViewport(int32_t player_nr, C4Viewport *prev=nullptr)
virtual void EnumerateMultiSamples(std::vector< int > &samples, int min_expected=0) const
virtual C4Window * Init(WindowKind windowKind, C4AbstractApp *pApp, const char *Title, const C4Rect *size)
bool GetSize(C4Rect *pRect)
virtual bool ReInit(C4AbstractApp *pApp)
void SetTitle(const char *Title)
virtual void PerformUpdate()
bool RestorePosition(const char *szWindowName, const char *szSubKey, bool fHidden=false)
void SetSize(unsigned int cx, unsigned int cy)
virtual void RequestUpdate()
bool StorePosition(const char *szWindowName, const char *szSubKey, bool fStoreSize=true)
void GrabMouse(bool grab)
void Add(StdSchedulerProc *pProc)
const char * getData() const
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
void MouseMove(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, class C4Viewport *pVP)