Merge branch 'master' into add-squirrel
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								config.tic
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								config.tic
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										11
									
								
								src/config.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/config.c
									
									
									
									
									
								
							@@ -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);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								src/menu.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/menu.c
									
									
									
									
									
								
							@@ -24,7 +24,7 @@
 | 
			
		||||
#include "fs.h"
 | 
			
		||||
 | 
			
		||||
#define DIALOG_WIDTH (TIC80_WIDTH/2)
 | 
			
		||||
#define DIALOG_HEIGHT (TIC80_HEIGHT/2-TOOLBAR_SIZE)
 | 
			
		||||
#define DIALOG_HEIGHT (TIC80_HEIGHT/2)
 | 
			
		||||
 | 
			
		||||
static const char* Rows[] = 
 | 
			
		||||
{
 | 
			
		||||
@@ -32,7 +32,8 @@ static const char* Rows[] =
 | 
			
		||||
	"RESET GAME",
 | 
			
		||||
	"GAMEPAD CONFIG",
 | 
			
		||||
	"",
 | 
			
		||||
	"EXIT TO TIC-80",
 | 
			
		||||
	"CLOSE GAME",
 | 
			
		||||
	"QUIT TIC-80",
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void resumeGame(Menu* menu)
 | 
			
		||||
@@ -56,12 +57,12 @@ static void gamepadConfig(Menu* menu)
 | 
			
		||||
	menu->gamepad.tab = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void exitToTIC(Menu* menu)
 | 
			
		||||
static void closeGame(Menu* menu)
 | 
			
		||||
{
 | 
			
		||||
	exitFromGameMenu();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void(*const MenuHandlers[])(Menu*) = {resumeGame, resetGame, gamepadConfig, NULL, exitToTIC};
 | 
			
		||||
static void(*const MenuHandlers[])(Menu*) = {resumeGame, resetGame, gamepadConfig, NULL, closeGame, exitStudio};
 | 
			
		||||
 | 
			
		||||
static tic_rect getRect(Menu* menu)
 | 
			
		||||
{
 | 
			
		||||
@@ -252,7 +253,7 @@ static void drawGamepadMenu(Menu* menu)
 | 
			
		||||
 | 
			
		||||
	static const char Label[] = "BACK";
 | 
			
		||||
 | 
			
		||||
	tic_rect rect = {dlgRect.x + 25, dlgRect.y + 49, (sizeof(Label)-1)*tic->font.width, tic->font.height};
 | 
			
		||||
	tic_rect rect = {dlgRect.x + 25, dlgRect.y + 56, (sizeof(Label)-1)*tic->font.width, tic->font.height};
 | 
			
		||||
 | 
			
		||||
	bool over = false;
 | 
			
		||||
	bool down = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -82,6 +82,8 @@ typedef struct
 | 
			
		||||
	const char* crtShader;
 | 
			
		||||
	const tic_cartridge* cart;
 | 
			
		||||
 | 
			
		||||
	s32 uiScale;
 | 
			
		||||
 | 
			
		||||
} StudioConfig;
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user