Window fix
This commit is contained in:
@@ -25,9 +25,6 @@ SOFTWARE.
|
||||
|
||||
#include "./base/ci2_base.h"
|
||||
|
||||
// Forward declaration for window title and class name.
|
||||
extern const ci2_sys_char *ci2_window_class;
|
||||
|
||||
// Opaque type for a window
|
||||
typedef struct CI2_Window CI2_Window;
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@ SOFTWARE.
|
||||
#include "../include/ci2.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
const ci2_sys_char *ci2_window_class = "Win32 CI2 Window";
|
||||
|
||||
struct CI2_Window {
|
||||
HWND hwnd;
|
||||
ci2_bool should_close;
|
||||
@@ -40,11 +38,14 @@ ci2_bool platform_init(void) {
|
||||
|
||||
CI2_Window* platform_create_window(const ci2_sys_char* title, int width, int height) {
|
||||
static ci2_bool class_registered = false;
|
||||
static ci2_sys_char *ci2_window_class = L"Win32 CI2 Window Class"
|
||||
|
||||
|
||||
if (!class_registered) {
|
||||
WNDCLASS wc = {0};
|
||||
wc.lpfnWndProc = window_proc;
|
||||
wc.hInstance = GetModuleHandle(NULL);
|
||||
wc.lpszClassName = L"CI2_WindowClass";
|
||||
wc.lpszClassName = ci2_window_class;
|
||||
RegisterClass(&wc);
|
||||
class_registered = true;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
MessageBoxA(NULL, "ci2_init failed", "Error", MB_OK | MB_ICONERROR);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
CI2_Window* window = ci2_create_window(ci2_window_class, 800, 600);
|
||||
static ci2_sys_char *ci2_window_title = L"Win32 CI2 Window Title";
|
||||
CI2_Window* window = ci2_create_window(ci2_window_title, 800, 600);
|
||||
if (!window) {
|
||||
MessageBoxA(NULL, "ci2_create_window failed", "Error", MB_OK | MB_ICONERROR);
|
||||
ci2_shutdown();
|
||||
@@ -67,8 +67,9 @@ int main(int argc, ci2_sys_char *argv[])
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
if (!ci2_init()) return 1;
|
||||
|
||||
CI2_Window* window = ci2_create_window(ci2_window_class, 800, 600);
|
||||
|
||||
static ci2_sys_char *ci2_window_title = "Linux CI2 Window Title";
|
||||
CI2_Window* window = ci2_create_window(ci2_window_title, 800, 600);
|
||||
if (!window) return 1;
|
||||
|
||||
while (ci2_poll_events(window)) {
|
||||
|
||||
BIN
tests/bin/01_ci2
Executable file
BIN
tests/bin/01_ci2
Executable file
Binary file not shown.
Reference in New Issue
Block a user