Skip to content

Commit

Permalink
always use 640x480 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kazzmir committed Jan 16, 2024
1 parent 2b8a4ea commit a6cb62d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/r-tech1/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,8 @@ static void doStandardLoop(Logic & logic, Draw & draw){
} else {
draw.updateFrames();
screen.clear();
draw.draw(screen.aspectRatio(640, 480));
// draw.draw(screen.aspectRatio(640, 480));
draw.draw(screen);
if (useTouchOverlay()){
InputManager::getTouch()->drawTouchOverlay(screen);
}
Expand Down
27 changes: 24 additions & 3 deletions src/r-tech1/graphics/sdl2/bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,15 +934,25 @@ int Graphics::setGraphicsMode(int mode, int width, int height){
DebugLog << "Unable to get renderer info: " << SDL_GetError() << endl;
}

SDL_RenderSetLogicalSize(renderer, width, height);
/*
double ratio = 640 / (double) 480;
if (width / ratio > height){
width = height * ratio;
} else {
height = width / ratio;
}
*/
// SDL_RenderSetLogicalSize(renderer, width, height);
/* always render at 640x480 resolution */
SDL_RenderSetLogicalSize(renderer, 640, 480);

global_handler = unique_ptr<SDLGlobalHandler>(new SDLGlobalHandler(window, renderer));

Screen = new Bitmap();
Screen->clip_x1 = 0;
Screen->clip_y1 = 0;
Screen->clip_x2 = width;
Screen->clip_y2 = height;
Screen->clip_x2 = 640;
Screen->clip_y2 = 480;

return 0;
}
Expand Down Expand Up @@ -993,6 +1003,17 @@ void Graphics::StretchedBitmap::hLine(const int x1, const int y, const int x2, c
*/

int Graphics::changeGraphicsMode(int mode, int width, int height){
/*
double ratio = 640 / (double) 480;
if (width / ratio > height){
width = height * ratio;
} else {
height = width / ratio;
}
*/
// SDL_RenderSetLogicalSize(global_handler->renderer, width, height);

// SDL_RenderSetLogicalSize(global_handler->renderer, width, height);
return 0;
}

Expand Down

0 comments on commit a6cb62d

Please sign in to comment.