Load
This function loads a texture from a texture (*.tex) file.
Syntax
- static Texture* Load(const std::string& path, int flags=0)
Parameters
- path: the file path to load the font from.
- flags: asset load parameters.
Returns
Returns the loaded texture. If the texture cannot be loaded, NULL is returned.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = NULL;
//Load a texture
Texture* texture = Texture::Load("Materials/Grass/grass01.tex");
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
context->SetColor(0,0,0,0);
context->Clear();
//Display the texture on screen
context->SetColor(1,1,1,0);
context->DrawImage(texture,0,0);
context->Sync();
}
return 0;
}