Latest version:
Tramway SDK 0.0.9
Github
Quick links
Home
Get Started

Core


This is the main system of the framework. It keeps track of the main loop, provides ID number generation services and keeps track of the framework version.

Key concepts


Frame

Each cycle of the main loop is called a frame. It is called that because during each loop you render a single frame of graphics.

Tick

There are 60 ticks in a second. If you have a 60hz monitor and you have turned on vsync or a frame limiter, then a tick will be the same as a frame.

This concept allows you to create applications as if they were always run at 60 frames per second.

Programming in C++


#include <framework/core.h>
API documentation page.

Every application created with the framework needs to initialize and update the core system.

Core::Init();

// main loop
while (true) {
    Core::Update();
}

That was very simple.

id_t id = GenerateID();

uint32_t ticks = GetTick();

double time = GetTickTime();
float delta_time GetDeltaTime();

After the previous bit of code is executed:

  • The variable id will contain a new, unique ID number.
  • The variable ticks will contain the number of ticks which have elapsed since the initialization of the application.
  • The variable time will contain the time, in seconds, that has passed since the initialization of the application.
  • The variable delta_time will contain the time, in seconds, that has passed between the start of this and the start of the previous frame.