Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SDL/SDL.h>
- #include <vg/openvg.h>
- #include <vg/vgu.h>
- int screenWidth = 640;
- int screenHeight = 480;
- SDL_Surface* screen;
- VGfloat blue[4] = {0, 0, 1, 1};
- int main(int argc, char* argv[]) {
- SDL_Event e;
- int finished = 0;
- SDL_Init(SDL_INIT_VIDEO);
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
- screen = SDL_SetVideoMode(screenWidth, screenHeight, 0, SDL_OPENGL | SDL_RESIZABLE);
- vgCreateContextSH(screenWidth, screenHeight);
- vgSetfv(VG_CLEAR_COLOR, 4, blue);
- while (!finished) {
- while (SDL_PollEvent(&e)) {
- switch(e.type) {
- case SDL_QUIT:
- finished = 1;
- break;
- case SDL_KEYDOWN:
- if (e.key.keysym.sym == SDLK_ESCAPE) {
- finished = 1;
- }
- break;
- case SDL_VIDEORESIZE:
- screenWidth = e.resize.w;
- screenHeight = e.resize.h;
- screen = SDL_SetVideoMode(screenWidth, screenHeight, 0, SDL_OPENGL | SDL_RESIZABLE);
- vgResizeSurfaceSH(screenWidth, screenHeight);
- break;
- }
- }
- vgClear(0, 0, screenWidth, screenHeight);
- SDL_GL_SwapBuffers();
- SDL_Delay(SDL_TIMESLICE);
- }
- vgDestroyContextSH();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement