From 18eb8db9c253601ca05dc02b2003e3a3eaebc5ed Mon Sep 17 00:00:00 2001 From: Oxore Date: Sat, 6 May 2023 21:03:55 +0300 Subject: Impl scroll A static rendering --- graphics.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'graphics.cpp') diff --git a/graphics.cpp b/graphics.cpp index 03379c5..0a6f699 100644 --- a/graphics.cpp +++ b/graphics.cpp @@ -18,8 +18,8 @@ Graphics::Graphics() _window = SDL_CreateWindow("Gut (SEGA MD/G emulator)", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, - VDP().render_width, - VDP().render_height, + VDP().kRenderWidth, + VDP().kRenderHeight, SDL_WINDOW_RESIZABLE); if (!_window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError()); @@ -36,8 +36,8 @@ Graphics::Graphics() _renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, - VDP().render_width, - VDP().render_height); + VDP().kRenderWidth, + VDP().kRenderHeight); if (!_render_texture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); SDL_Quit(); @@ -74,9 +74,9 @@ void Graphics::Render(const VDP& vdp) // TODO probably should return and propagate error abort(); } - for (size_t row = 0; row < VDP().render_height; row++) { + for (size_t row = 0; row < VDP().kRenderHeight; row++) { uint32_t *dst = (uint32_t*)((uint8_t*)pixels + row * pitch); - memcpy(dst, buffer, VDP().render_width * sizeof(*dst)); + memcpy(dst, buffer + row * VDP().kRenderWidth, VDP().kRenderWidth * sizeof(*dst)); } SDL_UnlockTexture(_render_texture); SDL_RenderClear(_renderer); -- cgit v1.2.3