diff options
author | Oxore <oxore@protonmail.com> | 2023-05-06 21:03:55 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2023-05-06 21:52:08 +0300 |
commit | 18eb8db9c253601ca05dc02b2003e3a3eaebc5ed (patch) | |
tree | 5a6e6a86d853495cd4a6afe4cb5e35abfffbe850 /graphics.cpp | |
parent | c32d616e1e014df30a8a50491b879e7599ba3243 (diff) |
Impl scroll A static rendering
Diffstat (limited to 'graphics.cpp')
-rw-r--r-- | graphics.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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); |