mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 20:15:35 -04:00
Fix opengl C backend crashing
This commit is contained in:
parent
e614908177
commit
29b4894c78
@ -12,9 +12,11 @@ int main(int argc, char* argv[]) {
|
||||
Window_Create(320, 320, 640, 480, &str, NULL);
|
||||
Window_SetVisible(true);
|
||||
Gfx_Init();
|
||||
Gfx_ClearColour(PackedCol_Red);
|
||||
|
||||
UInt8 RGB = 0;
|
||||
while (true) {
|
||||
Gfx_ClearColour(PackedCol_Create3(RGB, RGB, RGB));
|
||||
RGB++;
|
||||
Window_ProcessEvents();
|
||||
Platform_ThreadSleep(100);
|
||||
Gfx_BeginFrame();
|
||||
|
@ -440,7 +440,6 @@ void Window_Create(Int32 x, Int32 y, Int32 width, Int32 height, STRING_TRANSIENT
|
||||
if (atom == 0) {
|
||||
ErrorHandler_FailWithCode(GetLastError(), "Failed to register window class");
|
||||
}
|
||||
|
||||
win_Handle = CreateWindowExA(
|
||||
win_StyleEx, atom, title->buffer, win_Style,
|
||||
rect.left, rect.top, RECT_WIDTH(rect), RECT_HEIGHT(rect),
|
||||
@ -449,6 +448,10 @@ void Window_Create(Int32 x, Int32 y, Int32 width, Int32 height, STRING_TRANSIENT
|
||||
if (win_Handle == NULL) {
|
||||
ErrorHandler_FailWithCode(GetLastError(), "Failed to create window");
|
||||
}
|
||||
win_DC = GetDC(win_Handle);
|
||||
if (win_DC == NULL) {
|
||||
ErrorHandler_FailWithCode(GetLastError(), "Failed to get device context");
|
||||
}
|
||||
win_Exists = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user