mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
minwin: Add implementations for some minor function (#74)
This commit is contained in:
parent
c48935a64b
commit
83f092d8df
@ -525,7 +525,7 @@ if (ISLE_BUILD_CONFIG)
|
|||||||
CONFIG/res/config.rc
|
CONFIG/res/config.rc
|
||||||
)
|
)
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
list(APPEND config_SRC util/stdafx.cpp)
|
list(APPEND config_SRC miniwin/stdafx.cpp)
|
||||||
endif()
|
endif()
|
||||||
add_executable(config ${config_SRC})
|
add_executable(config ${config_SRC})
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include "miniwin_d3drm.h"
|
#include "miniwin_d3drm.h"
|
||||||
#include "miniwin_ddraw.h"
|
#include "miniwin_ddraw.h"
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_log.h>
|
#include <SDL3/SDL_log.h>
|
||||||
|
|
||||||
bool IsEqualGUID(const GUID& a, const GUID& b)
|
bool IsEqualGUID(const GUID& a, const GUID& b)
|
||||||
@ -60,3 +61,8 @@ void OutputDebugString(const char* lpOutputString)
|
|||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", lpOutputString);
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", lpOutputString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID WINAPI Sleep(DWORD dwMilliseconds)
|
||||||
|
{
|
||||||
|
SDL_Delay(dwMilliseconds);
|
||||||
|
}
|
||||||
|
|||||||
@ -310,10 +310,7 @@ inline BOOL SetWindowPos(HWND hWndInsertAfter, int X, int Y, int cx, int cy, UIN
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BOOL GetWindowRect(HWND hDlg, struct tagRECT* Rect)
|
BOOL GetWindowRect(HWND hDlg, struct tagRECT *Rect);
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline BOOL GetClientRect(LPRECT lpRect)
|
inline BOOL GetClientRect(LPRECT lpRect)
|
||||||
{
|
{
|
||||||
@ -540,9 +537,7 @@ inline AFX_MODULE_STATE* AfxGetModuleState()
|
|||||||
return &g_CustomModuleState;
|
return &g_CustomModuleState;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void AfxMessageBox(const char* message)
|
void AfxMessageBox(const char* message);
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void* GetProcAddress(HMODULE module, const char* name)
|
inline void* GetProcAddress(HMODULE module, const char* name)
|
||||||
{
|
{
|
||||||
@ -633,9 +628,7 @@ inline HMENU GetSystemMenu(HWND hWnd, bool bRevert)
|
|||||||
return reinterpret_cast<HMENU>(0x1234);
|
return reinterpret_cast<HMENU>(0x1234);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline VOID WINAPI Sleep(DWORD dwMilliseconds)
|
VOID WINAPI Sleep(DWORD dwMilliseconds);
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline HWND WINAPI FindWindow(LPCSTR lpClassName, LPCSTR lpWindowName)
|
inline HWND WINAPI FindWindow(LPCSTR lpClassName, LPCSTR lpWindowName)
|
||||||
{
|
{
|
||||||
|
|||||||
78
miniwin/stdafx.cpp
Normal file
78
miniwin/stdafx.cpp
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#include "../CONFIG/config.h"
|
||||||
|
#include "miniwin.h"
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
SDL_Window* window;
|
||||||
|
const char* title = "Configure LEGO Island";
|
||||||
|
|
||||||
|
BOOL CWinApp::InitInstance()
|
||||||
|
{
|
||||||
|
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)) {
|
||||||
|
SDL_Log("SDL_Init: %s\n", SDL_GetError());
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
window = SDL_CreateWindow(title, 640, 480, 0);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CWinApp::ExitInstance()
|
||||||
|
{
|
||||||
|
SDL_Quit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CWinApp::~CWinApp() = default;
|
||||||
|
|
||||||
|
const char* afxCurrentAppName = "";
|
||||||
|
AFX_MODULE_STATE g_CustomModuleState;
|
||||||
|
CWinApp* wndTop;
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
CWinApp base;
|
||||||
|
if (!base.InitInstance()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfigApp app;
|
||||||
|
wndTop = &app;
|
||||||
|
if (!app.InitInstance()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Event event;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
while (SDL_PollEvent(&event)) {
|
||||||
|
if (event.type == SDL_EVENT_QUIT) {
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Delay(16); // 60 FPS
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.ExitInstance() + app.ExitInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GetWindowRect(HWND hDlg, tagRECT* Rect)
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
SDL_GetWindowPosition(window, &x, &y);
|
||||||
|
SDL_GetWindowSize(window, &w, &h);
|
||||||
|
|
||||||
|
Rect->right = x;
|
||||||
|
Rect->top = y;
|
||||||
|
Rect->left = w + x;
|
||||||
|
Rect->bottom = h + y;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AfxMessageBox(const char* message)
|
||||||
|
{
|
||||||
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, message, NULL);
|
||||||
|
}
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#include "../CONFIG/config.h"
|
|
||||||
#include "miniwin.h"
|
|
||||||
|
|
||||||
BOOL CWinApp::InitInstance()
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CWinApp::ExitInstance()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CWinApp::~CWinApp() = default;
|
|
||||||
|
|
||||||
const char* afxCurrentAppName = "";
|
|
||||||
AFX_MODULE_STATE g_CustomModuleState;
|
|
||||||
CWinApp* wndTop;
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
CConfigApp app;
|
|
||||||
wndTop = &app;
|
|
||||||
if (!app.InitInstance()) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return app.ExitInstance();
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user