Mintoris Forum

Author Topic: GEN001 Hello World  (Read 1492 times)

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
GEN001 Hello World
« on: Jul 11, 2016, 11:08 PM »
Thought I would start out slow 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.

Code: [Select]
include "Game Engine Constants.inc"

' 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(1024, 1024)

' 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, 250, Align_Center)

' Add the text to layer 0 to
' make it visible.
GenAddText text, 0
« Last Edit: Jul 13, 2016, 01:37 AM by Chuck »

hoyoyo80

  • Full Member
  • ***
  • Posts: 66
Re: GEN001 Hello World
« Reply #1 on: Jul 12, 2016, 02:47 AM »
Nice‥ive learn this and pong sample.