options_menu->additem(MN_LABEL,"Options",0,0);
options_menu->additem(MN_HL,"",0,0);
+ options_menu->additem(MN_TOGGLE,"OpenGL",use_gl,0);
options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0);
if(audio_device)
{
switch (options_menu->check())
{
case 2:
- if(use_fullscreen != options_menu->item[2].toggled)
+ if(use_gl != options_menu->item[2].toggled)
{
- use_fullscreen = !use_fullscreen;
+#ifndef NOOPENGL
+ use_gl = !use_gl;
st_video_setup();
+#endif
}
break;
case 3:
- if(use_sound != options_menu->item[3].toggled)
- use_sound = !use_sound;
+ if(use_fullscreen != options_menu->item[3].toggled)
+ {
+ use_fullscreen = !use_fullscreen;
+ st_video_setup();
+ }
break;
case 4:
- if(use_music != options_menu->item[4].toggled)
+ if(use_sound != options_menu->item[4].toggled)
+ use_sound = !use_sound;
+ break;
+ case 5:
+ if(use_music != options_menu->item[5].toggled)
{
if(use_music)
{
}
}
break;
- case 5:
- if(show_fps != options_menu->item[5].toggled)
+ case 6:
+ if(show_fps != options_menu->item[6].toggled)
show_fps = !show_fps;
break;
}
#include "setup.h"
#include "texture.h"
+#define NO_TEXTURE 0
+
void (*texture_load) (texture_type* ptexture, const std::string& file, int use_alpha);
void (*texture_load_part)(texture_type* ptexture, const std::string& file, int x, int y, int w, int h, int use_alpha);
void (*texture_free) (texture_type* ptexture);
void texture_draw_gl(texture_type* ptexture, float x, float y, Uint8 alpha, bool update)
{
+if(ptexture->gl_texture == NO_TEXTURE)
+ texture_create_gl(ptexture->sdl_surface,&ptexture->gl_texture);
+
float pw = power_of_two(ptexture->w);
float ph = power_of_two(ptexture->h);
void texture_draw_bg_gl(texture_type* ptexture, Uint8 alpha, bool update)
{
+if(ptexture->gl_texture == NO_TEXTURE)
+ texture_create_gl(ptexture->sdl_surface,&ptexture->gl_texture);
+
float pw = power_of_two(ptexture->w);
float ph = power_of_two(ptexture->h);
void texture_draw_part_gl(texture_type* ptexture,float sx, float sy, float x, float y, float w, float h, Uint8 alpha, bool update)
{
+if(ptexture->gl_texture == NO_TEXTURE)
+ texture_create_gl(ptexture->sdl_surface,&ptexture->gl_texture);
+
float pw = power_of_two(ptexture->w);
float ph = power_of_two(ptexture->h);
ptexture->w = ptexture->sdl_surface->w;
ptexture->h = ptexture->sdl_surface->h;
+ ptexture->gl_texture = NO_TEXTURE;
}
void texture_load_part_sdl(texture_type* ptexture, const std::string& file, int x, int y, int w, int h, int use_alpha)
void texture_free_sdl(texture_type* ptexture)
{
SDL_FreeSurface(ptexture->sdl_surface);
+#ifndef NOOPENGL
+ if(ptexture->gl_texture != NO_TEXTURE)
+ glDeleteTextures(1, &ptexture->gl_texture);
+#endif
}