Getting Started with VEngine

The goal of VEngine is simple.

As a developer, you should focus on your logic, not the engine.

You shouldn't have to think about creating windows, managing the render loop, or initializing graphics.

The engine already does that for you.

Your job is to write the game.


Project Structure

When you open the project, you'll notice two important folders.

engine/
sandbox/

The engine contains VEngine itself.

The sandbox is your game.

Everything you build lives inside the Sandbox project.


The Entry Point

Every application starts from main.cpp.

#include "Sandbox.h"

int main()
{
    Sandbox game;
    game.Run();

    return 0;
}

This is all you need.

Create your game.

Run it.


Where should I write my game?

Inside:

Sandbox.cpp

More specifically:

void Sandbox::OnUpdate()
{
    // Your game goes here.
}

This function is called every frame.

If your game runs at 60 FPS,

OnUpdate() is executed approximately 60 times every second.

Everything that happens in your game starts here.

Think of OnUpdate() as the heartbeat of your game.


What happens behind the scenes?

You only write this:

void Sandbox::OnUpdate()
{
    Renderer::Clear(Colors::Black);

    Renderer::DrawCircle(
        400,
        225,
        50,
        Colors::Red
    );
}

Internally, VEngine does something like this:

Window::Create();

while (Window::Running())
{
    Renderer::BeginFrame();

    OnUpdate();

    Renderer::EndFrame();
}

Window::Destroy();

You never write the game loop.

The engine already owns it.

Your OnUpdate() is simply called every frame.

You provide the game logic.

The engine provides the infrastructure.


                main()
                  │
                  ▼
            Sandbox::Run()
                  │
                  ▼
         Application::Run()
                  │
      ┌───────────┴───────────┐
      ▼                       ▼
  Window                  Renderer
      │                       │
      └───────────────┬────────┘
                      ▼
                   OnUpdate()
                      ▲
                      │
             Your game logic
---

Drawing

VEngine currently provides a small rendering API.

Renderer::Clear(...);

Renderer::DrawCircle(...);

Renderer::DrawLine(...);

Renderer::DrawRectangle(...);

Renderer::DrawText(...);

Example:

Renderer::Clear(Colors::SkyBlue);

Renderer::DrawCircle(
    400,
    225,
    40,
    Colors::Red
);

Renderer::DrawLine(
    100,
    100,
    500,
    300,
    Colors::White
);

Renderer::DrawRectangle(
    100,
    350,
    200,
    80,
    Colors::Green
);

Renderer::DrawText(
    "Hello VEngine!",
    20,
    20,
    30,
    Colors::White
);

That's enough to begin building small applications and, more importantly, to visualize the mathematics that VEngine will introduce later.


Why doesn't Sandbox create the window?

Because that's not the game's responsibility.

The engine owns:

The Sandbox owns:

Keeping these responsibilities separate makes projects easier to understand and maintain.


What's next?

The renderer now provides enough functionality to begin building VEngine's mathematics library.

It will be about understanding vectors, transformations, and physics from first principles.

The renderer is simply the tool we'll use to visualize those ideas.

Github: VEngine

go back to tech