How to use
Getting Started
To get started with the Haze Engine, follow these steps:
-
Include the necessary header files:
-
Create an instance of the Haze::Engine class:
-
Initialize the engine:
-
Create entities using the Haze::Entity class:
-
Add components to the entities. Here are some examples:
//Add a Haze::Position component: entity1->addComponent(new Haze::Position(0, 0)); //Add a Haze::Sprite component: entity1->addComponent(new Haze::Sprite("assets/ship.png")); //Add a Haze::Animation component: entity1->addComponent(new Haze::Animation("assets/r-typesheet30a.gif", 34, 34, 3, 1)); //Add a Haze::Window component: entity2->addComponent(new Haze::Window(800, 600));
-
Start the game loop by checking if the engine is open:
Components
Component of the haze-core lib are at: [[ComponentCore Technical]]
Component of the haze-graphics lib are at: [[ComponentGfx Technical]]
Entity
Entity are defined at [[Entity Technical]]
Example Usage
Here's an example of how to use the Haze Engine to create a simple game loop:
#include <Haze>
int main()
{
Haze::Engine engine;
engine.init();
Haze::Entity *entity1 = engine.createEntity();
Haze::Entity *entity2 = engine.createEntity();
entity1->addComponent(new Haze::Position(0, 0));
entity1->addComponent(new Haze::Sprite("assets/ship.png"));
entity1->addComponent(new Haze::Animation("assets/r-typesheet30a.gif", 34, 34, 3, 1));
entity2->addComponent(new Haze::Window(800, 600));
while (engine.isOpen())
{
engine.update();
}
return 0;
}