GEN001 Hello World

We begin as tutorials always begin, with the good ole "Hello World" demo.

The attached program shows you how to turn on the Game Engine mode and display text.

The Graphics mode is turned on for a couple seconds just to show the font. Turning on the Graphics mode and displaying the font is not needed and only included to show that Game Engine fonts are just fancy tilesets.

include "Game Engine"

' Create the game engine font
font = GenDefaultFont(Font_Normal)

' Get the bitmap from the font just so
' we can look at it.
bitmap = GenGetBitmap(font)

orientation 2
Graphics on

' Show the font for a few seconds
DrawBitmap bitmap, screenx()/2, screeny()/2

wait 2000

GameEngine On

' Create a tile atlas
atlas = GenTileAtlas(512, 512)

' Put the font into the atlas
GenMapToAtlas atlas, font, 0, 0

' Load the atlas into the GPU
GenLoadAtlas atlas

' Create a Game Engine text object.
text = GenText("Hello World", font, ScreenX()/2, ScreenY()/2, ScreenX(), Align_Center)

' Add the text to layer 0 to
' make it visible.
GenAddText text, 0

Download Source

Game Engine Overview

Game Engine Tutorial








Become a Patron