Set window size

This commit is contained in:
Joshua Granick
2014-07-06 18:04:30 -07:00
parent a2be4e9a49
commit 5fae3b4ff6
5 changed files with 15 additions and 16 deletions

View File

@@ -181,7 +181,7 @@ class Window {
if (config.stencilBuffer) if (config.stencilBuffer)
flags |= STENCIL_BUFFER; flags |= STENCIL_BUFFER;
handle = lime_window_create (application.__handle, flags); handle = lime_window_create (application.__handle, width, height, flags);
#end #end
MouseEventManager.registerWindow (this); MouseEventManager.registerWindow (this);
@@ -242,7 +242,7 @@ class Window {
#if (cpp || neko) #if (cpp || neko)
private static var lime_window_create = System.load ("lime", "lime_window_create", 2); private static var lime_window_create = System.load ("lime", "lime_window_create", 4);
private static var lime_window_event_manager_register = System.load ("lime", "lime_window_event_manager_register", 2); private static var lime_window_event_manager_register = System.load ("lime", "lime_window_event_manager_register", 2);
#end #end

View File

@@ -23,7 +23,7 @@ namespace lime {
}; };
Window* CreateWindow (Application* application, int flags); Window* CreateWindow (Application* application, int width, int height, int flags);
} }

View File

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

View File

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

View File

@@ -18,7 +18,7 @@ namespace lime {
public: public:
SDLWindow (Application* application, int flags); SDLWindow (Application* application, int width, int height, int flags);
~SDLWindow (); ~SDLWindow ();
SDL_Window* sdlWindow; SDL_Window* sdlWindow;