diff --git a/src/gl/render.c b/src/gl/render.c
index 91707ef5d32d2e7af2209a0a61d8c34d44672bb9..41670016fa3872969e352ea937bf684c5ba987cb 100644 (file)
--- a/src/gl/render.c
+++ b/src/gl/render.c
#include "glob.h"
#include "render.h"
#include "glob.h"
#include "render.h"
+#include "system.h"
#include "files.h"
#include "memory.h"
#include "misc.h"
#include "files.h"
#include "memory.h"
#include "misc.h"
#else
# include <GL/gl.h>
#endif
#else
# include <GL/gl.h>
#endif
-#include <stdlib.h> // malloc free abs
-#include <assert.h> // assert
-#include <SDL.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
#define VGA_TRANSPARENT_COLOR 0
#define DEFAULT_SKY_COLOR 0x97
#define VGA_TRANSPARENT_COLOR 0
#define DEFAULT_SKY_COLOR 0x97
int SCRH = 200; // public
static int gamma;
static int fullscreen;
int SCRH = 200; // public
static int gamma;
static int fullscreen;
-static SDL_Surface *surf;
static rgb playpal[256];
static byte bright[256];
static GLuint lastTexture;
static rgb playpal[256];
static byte bright[256];
static GLuint lastTexture;
break;
}
GM_draw();
break;
}
GM_draw();
- SDL_GL_SwapBuffers();
+ Y_swap_buffers();
}
void R_alloc (void) {
}
void R_alloc (void) {
}
void R_init (void) {
}
void R_init (void) {
- Uint32 flags = SDL_OPENGL;
+ int res = 0;
+ int flags = SYSTEM_USE_OPENGL;
if (fullscreen) {
if (fullscreen) {
- flags = flags | SDL_FULLSCREEN;
+ flags |= SYSTEM_USE_FULLSCREEN;
}
}
+ logo("R_init: intialize opengl render\n");
+ int was = Y_videomode_setted();
if (SCRW <= 0 || SCRH <= 0) {
ERR_failinit("Invalid screen size %ix%i\n", SCRW, SCRH);
}
if (SCRW <= 0 || SCRH <= 0) {
ERR_failinit("Invalid screen size %ix%i\n", SCRW, SCRH);
}
- if (surf == NULL) {
+ if (was == 0) {
R_init_playpal(); // only onece
}
R_init_playpal(); // only onece
}
- surf = SDL_SetVideoMode(SCRW, SCRH, 0, flags);
- if (surf == NULL) {
- ERR_failinit("Unable to set video mode: %s\n", SDL_GetError());
+ res = Y_set_videomode(SCRW, SCRH, flags);
+ if (res == 0) {
+ ERR_failinit("Unable to set video mode\n");
}
root = R_cache_new();
assert(root);
}
root = R_cache_new();
assert(root);
void R_done (void) {
R_cache_free(root, 1);
void R_done (void) {
R_cache_free(root, 1);
+ Y_unset_videomode();
}
void R_setgamma (int g) {
}
void R_setgamma (int g) {
}
void R_toggle_fullscreen (void) {
}
void R_toggle_fullscreen (void) {
- fullscreen = !fullscreen;
- if (surf) {
- R_init(); // recreate window
- }
+ Y_set_fullscreen(!Y_get_fullscreen());
+ fullscreen = Y_get_fullscreen();
+ R_alloc();
}
void R_get_name (int n, char s[8]) {
}
void R_get_name (int n, char s[8]) {