no message
This commit is contained in:
parent
3517e080e3
commit
e2d987a208
8
Makefile
8
Makefile
|
@ -17,6 +17,7 @@ INCLUDES= \
|
|||
-I$(3RD_PARTY)/zlib-1.2.8 \
|
||||
-I$(3RD_PARTY)/giflib-5.1.4/lib \
|
||||
-I$(3RD_PARTY)/SDL2-2.0.7/include \
|
||||
-I$(3RD_PARTY)/sdl-gpu/include \
|
||||
-I$(3RD_PARTY)/wren-0.1.0/src/include \
|
||||
-I$(3RD_PARTY)/moonscript \
|
||||
-I$(BLIPBUF_LIB) \
|
||||
|
@ -26,11 +27,14 @@ INCLUDES= \
|
|||
|
||||
MINGW_LINKER_FLAGS= \
|
||||
-L$(PRE_BUILT)/mingw \
|
||||
-L$(3RD_PARTY)/sdl-gpu \
|
||||
-lmingw32 \
|
||||
-lSDL2main \
|
||||
-lSDL2 \
|
||||
-lcomdlg32 \
|
||||
-lws2_32 \
|
||||
-lSDL2_gpu \
|
||||
-lSDL2main \
|
||||
-lSDL2 \
|
||||
-lopengl32 \
|
||||
-mwindows
|
||||
|
||||
GTK_INCLUDES= `pkg-config --cflags gtk+-3.0`
|
||||
|
|
|
@ -1715,7 +1715,7 @@ static void processMouseStates()
|
|||
}
|
||||
}
|
||||
|
||||
static void studioTick(void* pixels)
|
||||
static void studioTick()
|
||||
{
|
||||
processShortcuts();
|
||||
processMouseStates();
|
||||
|
@ -1755,10 +1755,10 @@ static void studioTick(void* pixels)
|
|||
}
|
||||
|
||||
tic->api.blit(tic, scanline, overlap, data);
|
||||
memcpy(pixels, tic->screen, sizeof tic->screen);
|
||||
|
||||
recordFrame(pixels);
|
||||
drawDesyncLabel(pixels);
|
||||
recordFrame(tic->screen);
|
||||
drawDesyncLabel(tic->screen);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
83
src/system.c
83
src/system.c
|
@ -7,6 +7,8 @@
|
|||
#include <time.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include <SDL_gpu.h>
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
@ -577,6 +579,8 @@ static void pollEvent()
|
|||
|
||||
static void blitTexture()
|
||||
{
|
||||
tic_mem* tic = platform.studio->tic;
|
||||
|
||||
SDL_Rect rect = {0, 0, 0, 0};
|
||||
calcTextureRect(&rect);
|
||||
|
||||
|
@ -584,7 +588,9 @@ static void blitTexture()
|
|||
s32 pitch = 0;
|
||||
SDL_LockTexture(platform.texture, NULL, &pixels, &pitch);
|
||||
|
||||
platform.studio->tick(pixels);
|
||||
platform.studio->tick();
|
||||
|
||||
memcpy(pixels, tic->screen, sizeof tic->screen);
|
||||
|
||||
SDL_UnlockTexture(platform.texture);
|
||||
|
||||
|
@ -995,12 +1001,87 @@ static void emstick()
|
|||
#endif
|
||||
|
||||
static s32 start(s32 argc, char **argv, const char* folder)
|
||||
{
|
||||
initSound();
|
||||
|
||||
platform.net = createNet();
|
||||
|
||||
platform.studio = studioInit(argc, argv, platform.audio.spec.freq, folder, &systemInterface);
|
||||
tic_mem* tic = platform.studio->tic;
|
||||
|
||||
setWindowIcon();
|
||||
|
||||
initTouchGamepad();
|
||||
|
||||
GPU_Target* screen = GPU_Init(TIC80_FULLWIDTH * STUDIO_UI_SCALE, TIC80_FULLHEIGHT * STUDIO_UI_SCALE, GPU_INIT_DISABLE_VSYNC);
|
||||
GPU_Image* texture = GPU_CreateImage(TIC80_FULLWIDTH, TIC80_FULLHEIGHT, GPU_FORMAT_BGRA);
|
||||
|
||||
{
|
||||
{
|
||||
u64 nextTick = SDL_GetPerformanceCounter();
|
||||
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
||||
|
||||
while (!platform.studio->quit)
|
||||
{
|
||||
platform.missedFrame = false;
|
||||
|
||||
nextTick += Delta;
|
||||
|
||||
|
||||
{
|
||||
pollEvent();
|
||||
|
||||
GPU_Clear(screen);
|
||||
|
||||
{
|
||||
platform.studio->tick();
|
||||
GPU_UpdateImageBytes(texture, NULL, tic->screen, TIC80_FULLWIDTH * sizeof(u32));
|
||||
}
|
||||
|
||||
GPU_BlitScale(texture, NULL, screen, TIC80_FULLWIDTH/2*STUDIO_UI_SCALE, TIC80_FULLHEIGHT/2*STUDIO_UI_SCALE, STUDIO_UI_SCALE, STUDIO_UI_SCALE);
|
||||
|
||||
GPU_Flip(screen);
|
||||
|
||||
blitSound();
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
s64 delay = nextTick - SDL_GetPerformanceCounter();
|
||||
|
||||
if(delay < 0)
|
||||
{
|
||||
nextTick -= delay;
|
||||
platform.missedFrame = true;
|
||||
}
|
||||
else SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
platform.studio->close();
|
||||
|
||||
closeNet(platform.net);
|
||||
|
||||
SDL_CloseAudioDevice(platform.audio.device);
|
||||
|
||||
GPU_FreeImage(texture);
|
||||
|
||||
GPU_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 start2(s32 argc, char **argv, const char* folder)
|
||||
{
|
||||
SDL_SetHint(SDL_HINT_WINRT_HANDLE_BACK_BUTTON, "1");
|
||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
||||
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
|
||||
|
||||
|
||||
initSound();
|
||||
|
||||
platform.net = createNet();
|
||||
|
|
|
@ -76,7 +76,7 @@ typedef struct
|
|||
tic_mem* tic;
|
||||
bool quit;
|
||||
|
||||
void (*tick)(void* pixels);
|
||||
void (*tick)();
|
||||
void (*exit)();
|
||||
void (*close)();
|
||||
void (*updateProject)();
|
||||
|
|
Loading…
Reference in New Issue