Skip to content

Instantly share code, notes, and snippets.

@eterps
Created September 9, 2018 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eterps/a403d5c8226bbef18c143a6f21a96356 to your computer and use it in GitHub Desktop.
Save eterps/a403d5c8226bbef18c143a6f21a96356 to your computer and use it in GitHub Desktop.
obnc input focus issue
#include <obnc/OBNC.h>
#include ".obnc/Gfx.h"
#include <stdbool.h>
#include "SDL.h"
SDL_Surface *screen;
SDL_Event event;
void Gfx_Do_(void) {
SDL_Init(SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE);
SDL_WM_SetCaption("Simple Window", "Simple Window");
bool done=false;
while(!done) {
while(SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT) {
done=true;
}
}
SDL_FillRect(screen, &screen->clip_rect, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_Flip(screen);
}
SDL_Quit();
}
void Gfx_Init(void) {
}
CC=gcc
CFLAGS="-I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE"
LDLIBS="-L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa"
MODULE Gfx;
PROCEDURE Do*;
END Do;
END Gfx.
MODULE gfxtest;
IMPORT Gfx;
BEGIN
Gfx.Do
END gfxtest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment