Create
This function creates and returns a new window.
Syntax
- static Leadwerks::Window* Create(const std::string& title="Leadwerks", int x=0, int y=0, int width=1024, int height=768, int style=Titlebar)
Parameters
- title: the window text.
- x: the x position of the new window.
- y: the y position of the new window.
- width: the width of the new window.
- height: the height of the new window.
- style: the style of the new window. This can be any combination of the following bitwise flags:
- Window::Titlebar: the window will have a titlebar with text shown.
- Window::Resizable: the window will be resizable and have minimize and maximize buttons.
- Window;:Hidden: the window will be initially hidden on creation.
- Window::FullScreen: the window will take up the entire screen, and the screen resolution will be changed to match the window size.
Returns
Returns a new window. If the window cannot be created with the specified parameters, NULL is returned.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
Model* model = NULL;
int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->Move(0,0,-3);
Light* light = DirectionalLight::Create();
light->SetRotation(35,35,0);
//Create a model
model = Model::Box();
model->SetColor(0.0,0.0,1.0);
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
model->Turn(0,Leadwerks::Time::GetSpeed(),0);
Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync(false);
}
return 0;
}