#647: added "-uiscale" command line parameter and UI_SCALE=3 variable to the config

This commit is contained in:
Vadim Grigoruk 2018-08-01 10:14:45 +03:00
parent dbb762d8a9
commit 1504301a3b
6 changed files with 36 additions and 4 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -86,6 +86,16 @@ static void readConfigCrtMonitor(Config* config, lua_State* lua)
lua_pop(lua, 1);
}
static void readConfigUiScale(Config* config, lua_State* lua)
{
lua_getglobal(lua, "UI_SCALE");
if(lua_isinteger(lua, -1))
config->data.uiScale = lua_tointeger(lua, -1);
lua_pop(lua, 1);
}
static void readConfigCrtShader(Config* config, lua_State* lua)
{
lua_getglobal(lua, "CRT_SHADER");
@ -277,6 +287,7 @@ static void readConfig(Config* config)
readConfigNoSound(config, lua);
readConfigShowSync(config, lua);
readConfigCrtMonitor(config, lua);
readConfigUiScale(config, lua);
readTheme(config, lua);
}

View File

@ -3089,6 +3089,24 @@ static bool cmdInjectMap(Console* console, const char* param, const char* name)
return done;
}
static bool checkUIScale(Console* console, const char* param, const char* value)
{
bool done = false;
if(strcmp(param, "-uiscale") == 0)
{
s32 scale = atoi(value);
if(scale > 0)
{
console->config->data.uiScale = scale;
done = true;
}
}
return done;
}
void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config, s32 argc, char **argv)
{
if(!console->buffer) console->buffer = malloc(BufferSize(tic));
@ -3191,7 +3209,8 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
if(cmdInjectCode(console, first, second)
|| cmdInjectSprites(console, first, second)
|| cmdInjectMap(console, first, second))
|| cmdInjectMap(console, first, second)
|| checkUIScale(console, first, second))
argp |= mask;
}
}

View File

@ -12,7 +12,6 @@
#include <emscripten.h>
#endif
#define STUDIO_UI_SCALE 3
#define STUDIO_PIXEL_FORMAT GPU_FORMAT_RGBA
#define TEXTURE_SIZE (TIC80_FULLWIDTH)
#define OFFSET_LEFT ((TIC80_FULLWIDTH-TIC80_WIDTH)/2)
@ -1180,7 +1179,8 @@ static s32 start(s32 argc, char **argv, const char* folder)
platform.studio = studioInit(argc, argv, platform.audio.spec.freq, folder, &systemInterface);
enum{Width = TIC80_FULLWIDTH * STUDIO_UI_SCALE, Height = TIC80_FULLHEIGHT * STUDIO_UI_SCALE};
const s32 Width = TIC80_FULLWIDTH * platform.studio->config()->uiScale;
const s32 Height = TIC80_FULLHEIGHT * platform.studio->config()->uiScale;
platform.window = SDL_CreateWindow( TIC_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
Width, Height, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE| SDL_WINDOW_OPENGL);

View File

@ -82,6 +82,8 @@ typedef struct
const char* crtShader;
const tic_cartridge* cart;
s32 uiScale;
} StudioConfig;
typedef struct