no message
This commit is contained in:
parent
54b070850c
commit
b4c46a29e2
|
@ -48,7 +48,6 @@ static struct
|
||||||
} part;
|
} part;
|
||||||
} gamepad;
|
} gamepad;
|
||||||
|
|
||||||
bool quitFlag;
|
|
||||||
bool missedFrame;
|
bool missedFrame;
|
||||||
} platform;
|
} platform;
|
||||||
|
|
||||||
|
@ -592,7 +591,7 @@ static void pollEvent()
|
||||||
// showSoftKeyboard();
|
// showSoftKeyboard();
|
||||||
// break;
|
// break;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
platform.quitFlag = true;
|
platform.studio->quit = true;
|
||||||
// exitStudio();
|
// exitStudio();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -780,7 +779,7 @@ static void tick()
|
||||||
|
|
||||||
// if(!platform.fs) return;
|
// if(!platform.fs) return;
|
||||||
|
|
||||||
// if(platform.quitFlag)
|
// if(platform.quit)
|
||||||
// {
|
// {
|
||||||
// #if defined __EMSCRIPTEN__
|
// #if defined __EMSCRIPTEN__
|
||||||
// platform.studio->tic->api.clear(platform.studio->tic, TIC_COLOR_BG);
|
// platform.studio->tic->api.clear(platform.studio->tic, TIC_COLOR_BG);
|
||||||
|
@ -869,7 +868,7 @@ s32 main(s32 argc, char **argv)
|
||||||
u64 nextTick = SDL_GetPerformanceCounter();
|
u64 nextTick = SDL_GetPerformanceCounter();
|
||||||
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
||||||
|
|
||||||
while (!platform.quitFlag)
|
while (!platform.studio->quit)
|
||||||
{
|
{
|
||||||
platform.missedFrame = false;
|
platform.missedFrame = false;
|
||||||
|
|
||||||
|
|
26
src/map.c
26
src/map.c
|
@ -864,7 +864,8 @@ static void drawMapOvr(Map* map)
|
||||||
s32 scrollX = map->scroll.x % TIC_SPRITESIZE;
|
s32 scrollX = map->scroll.x % TIC_SPRITESIZE;
|
||||||
s32 scrollY = map->scroll.y % TIC_SPRITESIZE;
|
s32 scrollY = map->scroll.y % TIC_SPRITESIZE;
|
||||||
|
|
||||||
map->tic->api.map(map->tic, map->src, getBankTiles(), map->scroll.x / TIC_SPRITESIZE, map->scroll.y / TIC_SPRITESIZE,
|
tic_mem* tic = map->tic;
|
||||||
|
tic->api.map(tic, map->src, getBankTiles(), map->scroll.x / TIC_SPRITESIZE, map->scroll.y / TIC_SPRITESIZE,
|
||||||
TIC_MAP_SCREEN_WIDTH + 1, TIC_MAP_SCREEN_HEIGHT + 1, -scrollX, -scrollY, -1, 1);
|
TIC_MAP_SCREEN_WIDTH + 1, TIC_MAP_SCREEN_HEIGHT + 1, -scrollX, -scrollY, -1, 1);
|
||||||
|
|
||||||
if(map->canvas.grid || map->scroll.active)
|
if(map->canvas.grid || map->scroll.active)
|
||||||
|
@ -874,13 +875,14 @@ static void drawMapOvr(Map* map)
|
||||||
s32 screenScrollX = map->scroll.x % TIC80_WIDTH;
|
s32 screenScrollX = map->scroll.x % TIC80_WIDTH;
|
||||||
s32 screenScrollY = map->scroll.y % TIC80_HEIGHT;
|
s32 screenScrollY = map->scroll.y % TIC80_HEIGHT;
|
||||||
|
|
||||||
map->tic->api.line(map->tic, 0, TIC80_HEIGHT - screenScrollY, TIC80_WIDTH, TIC80_HEIGHT - screenScrollY, (tic_color_gray));
|
tic->api.line(tic, 0, TIC80_HEIGHT - screenScrollY, TIC80_WIDTH, TIC80_HEIGHT - screenScrollY, (tic_color_gray));
|
||||||
map->tic->api.line(map->tic, TIC80_WIDTH - screenScrollX, 0, TIC80_WIDTH - screenScrollX, TIC80_HEIGHT, (tic_color_gray));
|
tic->api.line(tic, TIC80_WIDTH - screenScrollX, 0, TIC80_WIDTH - screenScrollX, TIC80_HEIGHT, (tic_color_gray));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!map->sheet.show && checkMousePos(&rect))
|
if(!map->sheet.show && checkMousePos(&rect))
|
||||||
{
|
{
|
||||||
if(getKeyboard()[SDL_SCANCODE_SPACE])
|
if(tic->api.key(tic, tic_key_space))
|
||||||
|
// if(getKeyboard()[SDL_SCANCODE_SPACE])
|
||||||
{
|
{
|
||||||
processScrolling(map, checkMouseDown(&rect, SDL_BUTTON_LEFT) || checkMouseDown(&rect, SDL_BUTTON_RIGHT));
|
processScrolling(map, checkMouseDown(&rect, SDL_BUTTON_LEFT) || checkMouseDown(&rect, SDL_BUTTON_RIGHT));
|
||||||
}
|
}
|
||||||
|
@ -902,15 +904,17 @@ static void processKeyboard(Map* map)
|
||||||
{
|
{
|
||||||
enum{Step = 1};
|
enum{Step = 1};
|
||||||
|
|
||||||
if(getKeyboard()[SDL_SCANCODE_UP]) map->scroll.y -= Step;
|
tic_mem* tic = map->tic;
|
||||||
if(getKeyboard()[SDL_SCANCODE_DOWN]) map->scroll.y += Step;
|
|
||||||
if(getKeyboard()[SDL_SCANCODE_LEFT]) map->scroll.x -= Step;
|
|
||||||
if(getKeyboard()[SDL_SCANCODE_RIGHT]) map->scroll.x += Step;
|
|
||||||
|
|
||||||
static const u8 Scancodes[] = {SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT};
|
if(tic->api.key(tic, tic_key_up)) map->scroll.y -= Step;
|
||||||
|
if(tic->api.key(tic, tic_key_down)) map->scroll.y += Step;
|
||||||
|
if(tic->api.key(tic, tic_key_left)) map->scroll.x -= Step;
|
||||||
|
if(tic->api.key(tic, tic_key_right)) map->scroll.x += Step;
|
||||||
|
|
||||||
for(s32 i = 0; i < COUNT_OF(Scancodes); i++)
|
static const tic_key Keycodes[] = {tic_key_up, tic_key_down, tic_key_left, tic_key_right};
|
||||||
if(getKeyboard()[Scancodes[i]])
|
|
||||||
|
for(s32 i = 0; i < COUNT_OF(Keycodes); i++)
|
||||||
|
if(tic->api.key(tic, Keycodes[i]))
|
||||||
{
|
{
|
||||||
normalizeMap(&map->scroll.x, &map->scroll.y);
|
normalizeMap(&map->scroll.x, &map->scroll.y);
|
||||||
break;
|
break;
|
||||||
|
|
34
src/sfx.c
34
src/sfx.c
|
@ -631,22 +631,24 @@ static void processKeyboard(Sfx* sfx)
|
||||||
{
|
{
|
||||||
s32 keyboardButton = -1;
|
s32 keyboardButton = -1;
|
||||||
|
|
||||||
static const s32 Scancodes[] =
|
static const s32 Keycodes[] =
|
||||||
{
|
{
|
||||||
SDL_SCANCODE_Z,
|
tic_key_z,
|
||||||
SDL_SCANCODE_S,
|
tic_key_s,
|
||||||
SDL_SCANCODE_X,
|
tic_key_x,
|
||||||
SDL_SCANCODE_D,
|
tic_key_d,
|
||||||
SDL_SCANCODE_C,
|
tic_key_c,
|
||||||
SDL_SCANCODE_V,
|
tic_key_v,
|
||||||
SDL_SCANCODE_G,
|
tic_key_g,
|
||||||
SDL_SCANCODE_B,
|
tic_key_b,
|
||||||
SDL_SCANCODE_H,
|
tic_key_h,
|
||||||
SDL_SCANCODE_N,
|
tic_key_n,
|
||||||
SDL_SCANCODE_J,
|
tic_key_j,
|
||||||
SDL_SCANCODE_M,
|
tic_key_m,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tic_mem* tic = sfx->tic;
|
||||||
|
|
||||||
SDL_Keymod keymod = SDL_GetModState();
|
SDL_Keymod keymod = SDL_GetModState();
|
||||||
|
|
||||||
if(keymod & TIC_MOD_CTRL)
|
if(keymod & TIC_MOD_CTRL)
|
||||||
|
@ -655,8 +657,8 @@ static void processKeyboard(Sfx* sfx)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int i = 0; i < COUNT_OF(Scancodes); i++)
|
for(int i = 0; i < COUNT_OF(Keycodes); i++)
|
||||||
if(getKeyboard()[Scancodes[i]])
|
if(tic->api.key(tic, Keycodes[i]))
|
||||||
keyboardButton = i;
|
keyboardButton = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,7 +670,7 @@ static void processKeyboard(Sfx* sfx)
|
||||||
sfx->play.active = true;
|
sfx->play.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getKeyboard()[SDL_SCANCODE_SPACE])
|
if(tic->api.key(tic, tic_key_space))
|
||||||
sfx->play.active = true;
|
sfx->play.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
42
src/studio.c
42
src/studio.c
|
@ -96,9 +96,9 @@ static struct
|
||||||
u64 mdate;
|
u64 mdate;
|
||||||
}cart;
|
}cart;
|
||||||
|
|
||||||
SDL_Window* window;
|
// SDL_Window* window;
|
||||||
SDL_Renderer* renderer;
|
// SDL_Renderer* renderer;
|
||||||
SDL_Texture* texture;
|
// SDL_Texture* texture;
|
||||||
|
|
||||||
// struct
|
// struct
|
||||||
// {
|
// {
|
||||||
|
@ -131,7 +131,7 @@ static struct
|
||||||
bool active;
|
bool active;
|
||||||
} gesture;
|
} gesture;
|
||||||
|
|
||||||
const u8* keyboard;
|
// const u8* keyboard;
|
||||||
|
|
||||||
tic_key keycodes[KEYMAP_COUNT];
|
tic_key keycodes[KEYMAP_COUNT];
|
||||||
|
|
||||||
|
@ -226,7 +226,6 @@ static struct
|
||||||
|
|
||||||
FileSystem* fs;
|
FileSystem* fs;
|
||||||
|
|
||||||
bool quitFlag;
|
|
||||||
bool missedFrame;
|
bool missedFrame;
|
||||||
|
|
||||||
s32 argc;
|
s32 argc;
|
||||||
|
@ -238,9 +237,9 @@ static struct
|
||||||
.tic80local = NULL,
|
.tic80local = NULL,
|
||||||
// .tic = NULL,
|
// .tic = NULL,
|
||||||
|
|
||||||
.window = NULL,
|
// .window = NULL,
|
||||||
.renderer = NULL,
|
// .renderer = NULL,
|
||||||
.texture = NULL,
|
// .texture = NULL,
|
||||||
// .audio =
|
// .audio =
|
||||||
// {
|
// {
|
||||||
// .device = 0,
|
// .device = 0,
|
||||||
|
@ -272,7 +271,7 @@ static struct
|
||||||
.active = false,
|
.active = false,
|
||||||
},
|
},
|
||||||
|
|
||||||
.keyboard = NULL,
|
// .keyboard = NULL,
|
||||||
.keycodes =
|
.keycodes =
|
||||||
{
|
{
|
||||||
tic_key_up,
|
tic_key_up,
|
||||||
|
@ -316,7 +315,6 @@ static struct
|
||||||
},
|
},
|
||||||
|
|
||||||
.fullscreen = false,
|
.fullscreen = false,
|
||||||
.quitFlag = false,
|
|
||||||
.missedFrame = false,
|
.missedFrame = false,
|
||||||
.argc = 0,
|
.argc = 0,
|
||||||
.argv = NULL,
|
.argv = NULL,
|
||||||
|
@ -920,10 +918,10 @@ ClipboardEvent getClipboardEvent(SDL_Keycode keycode)
|
||||||
return TIC_CLIPBOARD_NONE;
|
return TIC_CLIPBOARD_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8* getKeyboard()
|
// const u8* getKeyboard()
|
||||||
{
|
// {
|
||||||
return studioImpl.keyboard;
|
// return studioImpl.keyboard;
|
||||||
}
|
// }
|
||||||
|
|
||||||
static void showPopupMessage(const char* text)
|
static void showPopupMessage(const char* text)
|
||||||
{
|
{
|
||||||
|
@ -933,7 +931,7 @@ static void showPopupMessage(const char* text)
|
||||||
|
|
||||||
static void exitConfirm(bool yes, void* data)
|
static void exitConfirm(bool yes, void* data)
|
||||||
{
|
{
|
||||||
studioImpl.quitFlag = yes;
|
studioImpl.studio.quit = yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void exitStudio()
|
void exitStudio()
|
||||||
|
@ -1213,12 +1211,12 @@ static void updateMDate()
|
||||||
|
|
||||||
static void updateTitle()
|
static void updateTitle()
|
||||||
{
|
{
|
||||||
char name[FILENAME_MAX] = TIC_TITLE;
|
// char name[FILENAME_MAX] = TIC_TITLE;
|
||||||
|
|
||||||
if(strlen(studioImpl.console->romName))
|
// if(strlen(studioImpl.console->romName))
|
||||||
sprintf(name, "%s [%s]", TIC_TITLE, studioImpl.console->romName);
|
// sprintf(name, "%s [%s]", TIC_TITLE, studioImpl.console->romName);
|
||||||
|
|
||||||
SDL_SetWindowTitle(studioImpl.window, name);
|
// SDL_SetWindowTitle(studioImpl.window, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void studioRomSaved()
|
void studioRomSaved()
|
||||||
|
@ -1644,8 +1642,8 @@ static void processGesture()
|
||||||
|
|
||||||
static void goFullscreen()
|
static void goFullscreen()
|
||||||
{
|
{
|
||||||
studioImpl.fullscreen = !studioImpl.fullscreen;
|
// studioImpl.fullscreen = !studioImpl.fullscreen;
|
||||||
SDL_SetWindowFullscreen(studioImpl.window, studioImpl.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
// SDL_SetWindowFullscreen(studioImpl.window, studioImpl.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void runProject()
|
void runProject()
|
||||||
|
@ -2578,7 +2576,7 @@ static void renderStudio()
|
||||||
// {
|
// {
|
||||||
// if(!studioImpl.fs) return;
|
// if(!studioImpl.fs) return;
|
||||||
|
|
||||||
// if(studioImpl.quitFlag)
|
// if(studioImpl.studio.quit)
|
||||||
// {
|
// {
|
||||||
// #if defined __EMSCRIPTEN__
|
// #if defined __EMSCRIPTEN__
|
||||||
// studioImpl.studio.tic->api.clear(studioImpl.studio.tic, TIC_COLOR_BG);
|
// studioImpl.studio.tic->api.clear(studioImpl.studio.tic, TIC_COLOR_BG);
|
||||||
|
|
|
@ -133,7 +133,7 @@ bool checkMouseDown(const SDL_Rect* rect, s32 button);
|
||||||
|
|
||||||
bool getGesturePos(SDL_Point* pos);
|
bool getGesturePos(SDL_Point* pos);
|
||||||
|
|
||||||
const u8* getKeyboard();
|
// const u8* getKeyboard();
|
||||||
|
|
||||||
void drawToolbar(tic_mem* tic, u8 color, bool bg);
|
void drawToolbar(tic_mem* tic, u8 color, bool bg);
|
||||||
void drawBitIcon(s32 x, s32 y, const u8* ptr, u8 color);
|
void drawBitIcon(s32 x, s32 y, const u8* ptr, u8 color);
|
||||||
|
@ -202,6 +202,8 @@ tic_map* getBankMap();
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
tic_mem* tic;
|
tic_mem* tic;
|
||||||
|
bool quit;
|
||||||
|
|
||||||
} Studio;
|
} Studio;
|
||||||
|
|
||||||
Studio* studioInit(s32 argc, char **argv, s32 samplerate);
|
Studio* studioInit(s32 argc, char **argv, s32 samplerate);
|
||||||
|
|
Loading…
Reference in New Issue