How To Draw Custom Text

This beginner level how to explains how to load a custom font and use it when you display text to the game window.

howtodrawcustomtext

Level

Beginner

Read these first

How To Draw Simple Text

Details

In SwinGame you can create the look and feel of your user interface. By loading custom fonts you can ensure the desired look of your text. SwinGame allows you to load in as many custom fonts as required and use them when necessary.

Call LoadFont to load your font into the program. When calling DrawText use the loaded font as an argument in the DrawText function.

For more advanced text formatting properties, take a look through the Text API.

Source Code Widget

  • program HowToDrawCustomText;
    uses SwinGame,sgTypes;
    
    procedure Main();
    
    begin
        OpenGraphicsWindow('Draw Custom Text' ,800 ,600 );
        ClearScreen();
        DrawText('You Win!!!' ,ColorGreen ,300 ,200 );
        DrawTextLines('OR DO YOU???' ,ColorRed ,ColorWhite ,'Arial' ,18 ,AlignCenter ,400 ,400 ,160 ,100 );
        RefreshScreen();
        Delay(5000 );
        ReleaseAllResources();
    end;
    begin
        Main();
    end.
    Download Now"
  • #include 
    #include "SwinGame.h"
    int main() 
    {
    
        open_graphics_window("Draw Custom Text" ,800 ,600 );
        clear_screen();
        draw_text("You Win!!!" ,color_green ,300 ,200 );
        draw_text_lines("OR DO YOU???" ,color_red ,color_white ,"Arial" ,18 ,ALIGN_CENTER ,400 ,400 ,160 ,100 );
        refresh_screen();
        delay(5000 );
        release_all_resources();
        return 0;
    }
    
    Download Now"
  • Source Code Coming Soon

  • Source Code Coming Soon

  • Source Code Coming Soon


Possibilities

You will be able to build an advanced story based program with more interactive fonts and formatting.