aboutsummaryrefslogtreecommitdiff
path: root/sdl/main.c
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-09-14 18:57:05 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-09-14 18:57:05 +0900
commit1ff3793322585443909d11284457811c461f8de4 (patch)
tree2ae703afca718f12137ec0a59ec67cfc2383bb2f /sdl/main.c
parent3e9da829c4ea58363a41f0e4e04124d4090ed6f3 (diff)
pacc: add viewport
Diffstat (limited to 'sdl/main.c')
-rw-r--r--sdl/main.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sdl/main.c b/sdl/main.c
index 39ead1b..e46a660 100644
--- a/sdl/main.c
+++ b/sdl/main.c
@@ -31,8 +31,10 @@ static struct {
char adpcmram[OPNA_ADPCM_RAM_SIZE];
struct fmdsp_pacc *fp;
atomic_flag fftdata_flag;
+ int scale;
} g = {
.fftdata_flag = ATOMIC_FLAG_INIT,
+ .scale = 1,
};
static void audiocb(void *ptr, Uint8 *bufptr, int len) {
@@ -116,7 +118,7 @@ int main(int argc, char **argv) {
g.win = SDL_CreateWindow(
"FMPlayer SDL",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
- 640*2, 400*2,
+ PC98_W, PC98_H,
SDL_WINDOW_OPENGL);
if (!g.win) {
SDL_Log("Cannot create window\n");
@@ -170,7 +172,8 @@ int main(int argc, char **argv) {
SDL_free(e.drop.file);
break;
case SDL_KEYDOWN:
- if (e.key.keysym.scancode == SDL_SCANCODE_F11) {
+ switch (e.key.keysym.scancode) {
+ case SDL_SCANCODE_F11:
if (e.key.keysym.mod & KMOD_SHIFT) {
fmdsp_pacc_set_right_mode(
g.fp,
@@ -180,6 +183,15 @@ int main(int argc, char **argv) {
g.fp,
(fmdsp_pacc_left_mode(g.fp) + 1) % FMDSP_LEFT_MODE_CNT);
}
+ break;
+ case SDL_SCANCODE_F12:
+ g.scale++;
+ if (g.scale > 3) g.scale = 1;
+ SDL_SetWindowSize(g.win, PC98_W*g.scale, PC98_H*g.scale);
+ pacc.viewport_scale(pc, g.scale);
+ break;
+ default:
+ break;
}
if (e.key.keysym.mod & KMOD_CTRL) {
switch (e.key.keysym.scancode) {