Day 27 complete.
This commit is contained in:
+17
-8
@@ -25,6 +25,9 @@
|
||||
#include <x86intrin.h>
|
||||
#endif
|
||||
|
||||
#define RESOLUTION_WIDTH 960
|
||||
#define RESOLUTION_HEIGHT 540
|
||||
|
||||
static B32 GlobalRunning;
|
||||
|
||||
static U64 GlobalPerfCountFrequency;
|
||||
@@ -140,7 +143,6 @@ void DEBUGPlatformFreeFileMemory(thread_context *Thread, void *Memory)
|
||||
free(Memory);
|
||||
}
|
||||
|
||||
|
||||
static sdl_window_dimension SDLGetWindowDimension(SDL_Window *Window)
|
||||
{
|
||||
sdl_window_dimension Dimension;
|
||||
@@ -186,8 +188,8 @@ static void SDLDisplayBufferInWindow(offscreen_buffer Buffer,
|
||||
/* SDL_RenderCopy(Renderer, Buffer.Texture, 0, 0); */
|
||||
dest_rect.x = 0;
|
||||
dest_rect.y = 0;
|
||||
dest_rect.w = 500;
|
||||
dest_rect.h = 500;
|
||||
dest_rect.w = RESOLUTION_WIDTH;
|
||||
dest_rect.h = RESOLUTION_HEIGHT;
|
||||
SDL_RenderCopy(Renderer, Buffer.Texture, 0, (const SDL_Rect *)(&dest_rect));
|
||||
SDL_RenderPresent(Renderer);
|
||||
}
|
||||
@@ -705,15 +707,20 @@ S32 main(S32 argc, char *argv[])
|
||||
* protocol. However, SDL_WINDOW_ALWAYS_ON_TOP does work on KDE
|
||||
* under Wayland. I have not tested GNOME. */
|
||||
Window = SDL_CreateWindow("Handmade Hero", SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED, 500, 500,
|
||||
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALWAYS_ON_TOP);
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
RESOLUTION_WIDTH, RESOLUTION_HEIGHT,
|
||||
SDL_WINDOW_RESIZABLE |
|
||||
SDL_WINDOW_ALWAYS_ON_TOP);
|
||||
|
||||
if(Window) {
|
||||
SDL_Renderer *Renderer;
|
||||
|
||||
SDL_DisplayMode display_mode;
|
||||
SDL_GetCurrentDisplayMode(0, &display_mode);
|
||||
|
||||
Renderer = SDL_CreateRenderer(Window, -1, SDL_RENDERER_PRESENTVSYNC);
|
||||
SDL_SetWindowPosition(Window, 900, 300); /* TODO: Check that this
|
||||
works on Linux. */
|
||||
SDL_SetWindowPosition(Window, (display_mode.w - RESOLUTION_WIDTH),
|
||||
(display_mode.h - RESOLUTION_HEIGHT));
|
||||
/* "Wayland needs an event loop and rendering or it won't function."
|
||||
* https://github.com/libsdl-org/SDL/issues/7699#issuecomment-1545684792 */
|
||||
/* NOTE: This means that we need to readraw to even resize the
|
||||
@@ -816,7 +823,8 @@ S32 main(S32 argc, char *argv[])
|
||||
#endif
|
||||
|
||||
MonitorRefreshHz = SDLGetWindowRefreshRate(Window);
|
||||
GameUpdateHz = MonitorRefreshHz;
|
||||
/*GameUpdateHz = MonitorRefreshHz;*/
|
||||
GameUpdateHz = 30; /* NOTE: Temporarily target 30 FPS. */
|
||||
TargetSecondsPerFrame = 1.0f / (F32)GameUpdateHz;
|
||||
|
||||
NewInput = &Input[0];
|
||||
@@ -1070,6 +1078,7 @@ S32 main(S32 argc, char *argv[])
|
||||
Buffer.Memory = GlobalBackbuffer.Memory;
|
||||
Buffer.Width = GlobalBackbuffer.Width;
|
||||
Buffer.Height = GlobalBackbuffer.Height;
|
||||
Buffer.BytesPerPixel = 4;
|
||||
Buffer.Pitch = GlobalBackbuffer.Pitch;
|
||||
|
||||
if(SDLState.InputRecordingIndex) {
|
||||
|
||||
Reference in New Issue
Block a user