- La tecla de parar passa a ser F12 (en compte de F1).

- [FIX] Ja no intentem recuperar la posició de la finestra. Ara reapareix centrada.
- [NEW] Si s'intenta ficar un zoom menor de 1, es corregeix a 1.
- [NEW] Si s'intenta ficar un zoom major que el tamany de la pantalla, redueix el zoom fins a un correcte.
This commit is contained in:
2023-10-09 11:29:17 +02:00
parent 0b6e30c01b
commit b29c6c873d
2 changed files with 21 additions and 8 deletions

View File

@@ -28,8 +28,8 @@ uint8_t screen_zoom = 4;
bool screen_fullscreen = false;
bool screen_cursor = true;
int windowpos_x = SDL_WINDOWPOS_UNDEFINED;
int windowpos_y = SDL_WINDOWPOS_UNDEFINED;
int desktop_width = 0;
int desktop_height = 0;
surface_t surfaces[10];
surface_t *screen_surface = &surfaces[0];
@@ -226,14 +226,17 @@ void setmap(uint8_t surface) {
}
void createDisplay() {
mini_win = SDL_CreateWindow(window_title, windowpos_x, windowpos_y, screen_width*screen_zoom, screen_height*screen_zoom, screen_fullscreen?SDL_WINDOW_FULLSCREEN_DESKTOP:SDL_WINDOW_SHOWN);
if (screen_zoom <= 0) screen_zoom = 1;
while (screen_width*screen_zoom > desktop_width || screen_height*screen_zoom > desktop_height) screen_zoom--;
mini_win = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width*screen_zoom, screen_height*screen_zoom, screen_fullscreen?SDL_WINDOW_FULLSCREEN_DESKTOP:SDL_WINDOW_SHOWN);
windowID = SDL_GetWindowID(mini_win);
mini_ren = SDL_CreateRenderer(mini_win, -1, 0);
//SDL_CreateWindowAndRenderer(512,512,0,&mini_win,&mini_ren);
SDL_RenderSetLogicalSize(mini_ren, screen_width, screen_height);
SDL_ShowCursor(screen_cursor?SDL_ENABLE:SDL_DISABLE);
mini_bak = SDL_CreateTexture(mini_ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
SDL_GetWindowPosition(mini_win, &windowpos_x, &windowpos_y);
//SDL_GetWindowPosition(mini_win, &windowpos_x, &windowpos_y);
}
void destroyDisplay() {
@@ -288,6 +291,16 @@ int main(int argc,char*argv[]){
setdest(newsurf(screen_width, screen_height));
SDL_Init(SDL_INIT_EVERYTHING);
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) != 0)
{
SDL_Log("SDL_GetDesktopDisplayMode failed: %s", SDL_GetError());
return 1;
}
desktop_width = dm.w;
desktop_height = dm.h;
createDisplay();
initGamePad();
@@ -329,7 +342,7 @@ int main(int argc,char*argv[]){
}
*/
#ifdef DEBUG
if (mini_eve.key.keysym.scancode == SDL_SCANCODE_F1) {
if (mini_eve.key.keysym.scancode == SDL_SCANCODE_F12) {
if (lua_is_playing()) {
lua_quit();
quitaudio();
@@ -355,13 +368,13 @@ int main(int argc,char*argv[]){
if (mini_eve.type == SDL_CONTROLLERBUTTONDOWN) {
pad_just_pressed = mini_eve.cbutton.button;
}
if ( (mini_eve.type == SDL_WINDOWEVENT) &&
/*if ( (mini_eve.type == SDL_WINDOWEVENT) &&
(mini_eve.window.windowID == windowID) &&
(mini_eve.window.event == SDL_WINDOWEVENT_MOVED) ) {
windowpos_x = mini_eve.window.data1-4;
windowpos_y = mini_eve.window.data2-36;
//SDL_GetWindowPosition(mini_win, &windowpos_x, &windowpos_y);
}
}*/
}
keys = SDL_GetKeyboardState(NULL);
mouse_buttons = SDL_GetMouseState(&mouse_x, &mouse_y);

View File

@@ -1,3 +1,3 @@
#pragma once
#define MINI_VERSION "0.9.81d"
#define MINI_VERSION "0.9.82d"