no message

This commit is contained in:
BADIM-PC\Vadim 2018-02-21 14:29:32 +03:00
parent f73530a575
commit d442813de8
2 changed files with 24 additions and 2 deletions

View File

@ -2,11 +2,13 @@ in vec2 texCoord;
out vec4 fragColor;
uniform sampler2D tex;
uniform float trg_w;
uniform float trg_h;
// Emulated input resolution.
vec2 res=vec2(256.0,144.0);
vec2 trg=res*4.0;
vec2 trg=vec2(trg_w, trg_h);
// Hardness of scanline.
// -8.0 = soft

View File

@ -206,6 +206,17 @@ static void initTouchGamepad()
}
static void calcTextureRect(SDL_Rect* rect)
{
s32 w, h;
SDL_GetWindowSize(platform.window, &w, &h);
rect->x = OFFSET_LEFT * w / TIC80_FULLWIDTH;
rect->y = OFFSET_TOP * h / TIC80_FULLHEIGHT;
rect->w = TIC80_WIDTH * w / TIC80_FULLWIDTH;
rect->h = TIC80_HEIGHT * h / TIC80_FULLHEIGHT;
}
static void calcTextureRect2(SDL_Rect* rect)
{
SDL_GetWindowSize(platform.window, &rect->w, &rect->h);
@ -1170,6 +1181,7 @@ static s32 start(s32 argc, char **argv, const char* folder)
u32 crt_shader = 0;
load_shader_program(&crt_shader, "data/shaders/common.vert", "data/shaders/crt-lottes.frag");
{
u64 nextTick = SDL_GetPerformanceCounter();
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
@ -1192,7 +1204,15 @@ static s32 start(s32 argc, char **argv, const char* folder)
GPU_UpdateImageBytes(texture, NULL, (const u8*)tic->screen, TIC80_FULLWIDTH * sizeof(u32));
blitGpuTexture(screen, texture);
{
s32 w, h;
SDL_GetWindowSize(platform.window, &w, &h);
GPU_SetUniformf(GPU_GetUniformLocation(crt_shader, "trg_w"), w);
GPU_SetUniformf(GPU_GetUniformLocation(crt_shader, "trg_h"), h);
GPU_BlitScale(texture, NULL, screen, 0, 0, (float)w / TIC80_FULLWIDTH, (float)h / TIC80_FULLHEIGHT);
}
}
GPU_Flip(screen);