2.1. tsInit

Syntax

Pascal

function tsInit(Name: tsEnum): tsBool;

C/C++

tsBool tsInit(tsEnum Name);

Description

Initialize the TextSuite library or some of the subsystems. The tsInit function count how much TS_INIT_TEXTSUITE is getting initialized. If the librarys core already was initialized this functions does nothing instead of incrementing this counter. If you want to quit the library you have to call tsQuit and the counter will decreased. If the counter reached zero the library and all subsystems will quit. So it is importat to call tsQuit same count you have called tsInit with the flag TS_INIT_TEXTSUITE.

[Warning] Warning

The internal counter dosn't mean an callcounter of tsInit! It means an counter how much the flag TS_INIT_TEXTSUITE is present in the name parameter.

If you want to know what requirents exists for the subsystems please take a look in the requirements and restrictions article.

Params

Name

The parameter Name provides an set of consts that describes which subsystems will be initialized.

TS_INIT_TEXTSUITE

Initializes the core of the TextSuite library.

[Important] Important

Before you can use any functionallity of this library you must initialize the TextSuite library.

TS_INIT_SDL_TTF

Initializes some functions of the SDL_ttf library. These functions are used to create chars with SDL_ttf. Also some functions of the SDL library will be initialized.

This system is used for TS_CREATOR_SDL. Also some functions of the SDL library will be initialized.

TS_INIT_SDL_IMAGE

Initializes some functions of SDL_image.

This image library will be used for TS_IMAGE_LIBRARY_SDL to load external images. Also some functions of the SDL library will be initialized.

TS_INIT_GDI

Initializes some functions from the Graphic Device Interfaces (GDI) under windows. This functions are used to create chars with the GDI.

This system is used for TS_CREATOR_GDI, TS_CREATOR_GDI_FACENAME.

TS_INIT_OPENGL

Initializes functions from OpenGL. If you want to print some text on the screen you need to initialize OpenGL. At this moment only functions from the 1.1 core will be uses.

This system is used for TS_RENDERER_OPENGL.

Return Values

TS_TRUE

If all systems was successfully initialized the function returns TS_TRUE.

TS_FALSE

If the initialization of one ore more systems failed the function returns TS_FALSE.

Error Codes

TS_NOT_INITIALIZED

The initialization of one ore more subsystems failed.

Example

if tsInit(TS_INIT_TEXTSUITE or TS_INIT_GDI or TS_INIT_OPENGL) = TS_FALSE then
  // Initialization failed
else
  // Initialization successfull

Example 2.1. Initializing library (Pascal)