first pass of adding flags for sdl (stencil and depthbuffer)

This commit is contained in:
Michael Bickel
2014-06-17 04:56:52 +02:00
committed by Joshua Granick
parent e84731a9fb
commit c45b5f52e4
7 changed files with 43 additions and 15 deletions

View File

@@ -159,9 +159,9 @@ namespace lime {
}
value lime_window_create (value application) {
value lime_window_create (value application, value flags) {
Window* window = CreateWindow ((Application*)(intptr_t)val_float (application));
Window* window = CreateWindow ((Application*)(intptr_t)val_float (application), val_int(flags));
return alloc_float ((intptr_t)window);
}
@@ -191,7 +191,7 @@ namespace lime {
DEFINE_PRIM (lime_system_get_timestamp, 0);
DEFINE_PRIM (lime_touch_event_manager_register, 2);
DEFINE_PRIM (lime_update_event_manager_register, 2);
DEFINE_PRIM (lime_window_create, 1);
DEFINE_PRIM (lime_window_create, 2);
DEFINE_PRIM (lime_window_event_manager_register, 2);

View File

@@ -4,9 +4,18 @@
namespace lime {
SDLWindow::SDLWindow (Application* application) {
SDLWindow::SDLWindow (Application* application, int flags) {
currentApplication = application;
// config the window
if (flags & DEPTH_BUFFER)
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 32 - (flags & STENCIL_BUFFER) ? 8 : 0);
if (flags & STENCIL_BUFFER)
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
sdlWindow = SDL_CreateWindow ("Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_OPENGL);
}
@@ -19,9 +28,9 @@ namespace lime {
}
Window* CreateWindow (Application* application) {
Window* CreateWindow (Application* application, int flags) {
return new SDLWindow (application);
return new SDLWindow (application, flags);
}

View File

@@ -8,12 +8,17 @@
namespace lime {
enum SDLWindowFlags
{
DEPTH_BUFFER = 0x00000200,
STENCIL_BUFFER = 0x00000400,
};
class SDLWindow : public Window {
public:
SDLWindow (Application* application);
SDLWindow (Application* application, int flags);
~SDLWindow ();
SDL_Window* sdlWindow;