Skip to content

Instantly share code, notes, and snippets.

@ox
Created August 14, 2021 21:15
Show Gist options
  • Select an option

  • Save ox/25a9f125f016662e0a4ff76ee9e4ea3a to your computer and use it in GitHub Desktop.

Select an option

Save ox/25a9f125f016662e0a4ff76ee9e4ea3a to your computer and use it in GitHub Desktop.

Revisions

  1. ox created this gist Aug 14, 2021.
    58 changes: 58 additions & 0 deletions uxnemu.c.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,58 @@
    diff --git a/projects/examples/demos/font.tal b/projects/examples/demos/font.tal
    index 512ba5d..1513a6f 100644
    --- a/projects/examples/demos/font.tal
    +++ b/projects/examples/demos/font.tal
    @@ -188,4 +188,4 @@ RTN
    @font-path-small
    "projects/fonts/atari8.uf1 $1

    -@font-data
    \ No newline at end of file
    +@font-data
    diff --git a/src/uxnemu.c b/src/uxnemu.c
    index 3380b68..3b4b4c8 100644
    --- a/src/uxnemu.c
    +++ b/src/uxnemu.c
    @@ -35,6 +35,7 @@ static Device *devsystem, *devscreen, *devmouse, *devctrl, *devaudio0, *devconso
    static Uint32 stdin_event;

    static Uint8 zoom = 1, reqdraw = 0;
    +static int fullscreen = SDL_WINDOW_FULLSCREEN_DESKTOP;

    static Uint8 font[][8] = {
    {0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c},
    @@ -154,6 +155,18 @@ screencapture(void)
    fprintf(stderr, "Saved %s\n", fname);
    }

    +static void
    +togglefullscreen(void)
    +{
    + if (fullscreen) {
    + fullscreen = 0;
    + } else {
    + fullscreen = SDL_WINDOW_FULLSCREEN_DESKTOP;
    + }
    +
    + SDL_SetWindowFullscreen(gWindow, fullscreen);
    +}
    +
    static void
    quit(void)
    {
    @@ -210,6 +223,7 @@ init(void)
    }
    gRect.h = zoom * ppu.height;
    ppu.pixels = idxSurface->pixels;
    + SDL_SetWindowFullscreen(gWindow, fullscreen);
    SDL_StartTextInput();
    SDL_ShowCursor(SDL_DISABLE);
    return 1;
    @@ -256,6 +270,7 @@ doctrl(Uxn *u, SDL_Event *event, int z)
    case SDLK_F1: if(z) togglezoom(u); break;
    case SDLK_F2: if(z) toggledebug(u); break;
    case SDLK_F3: if(z) screencapture(); break;
    + case SDLK_F4: if(z) togglefullscreen(); break;
    }

    /* clang-format on */