I cannot for the life of me figure out why I can't draw this silly image to the screen. Checked the path to the texture file, it was generated from LE from a PNG fine....
#include "App.h"
using namespace Leadwerks;
App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}
App::~App() { delete world; delete window; }
bool freelookmode=true;
Texture* sidebar = NULL;
bool App::Start()
{
//Initialize Steamworks (optional)
/*if (!Steamworks::Initialize())
{
System::Print("Error: Failed to initialize Steam.");
return false;
}*/
//Create a window
window = Leadwerks::Window::Create("StrategyGame", 0, 0, 1920, 1080, Leadwerks::Window::FullScreen);
//Create a context
context = Context::Create(window);
//Create a world
world = World::Create();
//Create a camera
camera = Camera::Create();
camera->Move(0,50,0);
camera->SetRotation(75,0,0);
std::string mapname = System::GetProperty("map","Maps/start.map");
Map::Load(mapname);
//Load UI
sidebar = Texture::Load("Materials/Shadowless/menubar2.tex");
//Move the mouse to the center of the screen
window->SetMousePosition(context->GetWidth()/2,context->GetHeight()/2);
return true;
}
bool App::Loop()
{
//Close the window to end the program
if (window->Closed()) return false;
//Press escape to end freelook mode
if (window->KeyHit(Key::Escape))
{
if (!freelookmode) return false;
freelookmode=false;
window->ShowMouse();
}
if (freelookmode)
{
//Keyboard movement
float strafe = (window->KeyDown(Key:) - window->KeyDown(Key::A))*Leadwerks::Time::GetSpeed() * 0.5;
float move = (window->KeyDown(Key::W) - window->KeyDown(Key::S))*Leadwerks::Time::GetSpeed() * 0.5;
float rotate = (window->KeyDown(Key::Q) - window->KeyDown(Key::E))*Leadwerks::Time::GetSpeed() * 0.5;
camera->Translate(strafe,0,move);
camera->Turn(0,0,rotate);
}
// UI
context->SetColor(0,0,0);
context->Clear();
context->SetColor(1,1,1);
context->DrawImage(sidebar,0,0);
Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync();
return true;
}