Skip to content
3DExtended edited this page Oct 22, 2017 · 19 revisions

CGameEngine

GUI.FontHandler.Character

A helper class which symbols a character from a font file

Methods

txAdsi

Getter for the xAdvance attribute

Return value

The xAdvance

tsrzY

Getter for the sizeY attribute

Return value

The sizeY

tsrzX

Getter for the sizeX attribute

Return value

The sizeX

tOst

Getter for the yOffset attribute

Return value

The yOffset

txOst

Getter for the xOffset attribute

Return value

The xOffset

tTxtd

Getter for the yTextureCoord attribute

Return value

The yTextureCoord

txTxtd

Getter for the xTextureCoord attribute

Return value

The xTextureCoord

tD

Getter for the ID attribute

Return value

The ID

Constructor

A constructor that creates a character instance with its specified attributes

Parameters

id: The id of this char (normally ascii representation of char)

xTextureCoord: X component of the upper left corner of this char on its font-texture

yTextureCoord: Y component of the upper left corner of this char on its font-texture

xOffset: A virtual cursor will be used. This value specifies where to locate this chars vertex depending on the x-offset

yOffset: A virtual cursor will be used. This value specifies where to locate this chars vertex depending on the y-offset

sizeX: The width of this character

sizeY: The height of this character

xAdvance: Which offset receives the virtual cursor after writing this letter

Constructor

Default constructor.

GUI.FontHandler

This class is used to represent one font on the screen. It handles the render call that renders every text element on the screen and also is able to return a Text object to represent one text. This class is implemented using the singleton pattern.

Methods

ssit:txAdsi

Getter for the xAdvance attribute

Return value

The xAdvance

ssit:tsrzY

Getter for the sizeY attribute

Return value

The sizeY

ssit:tsrzX

Getter for the sizeX attribute

Return value

The sizeX

ssit:tOst

Getter for the yOffset attribute

Return value

The yOffset

ssit:txOst

Getter for the xOffset attribute

Return value

The xOffset

ssit:tTxtd

Getter for the yTextureCoord attribute

Return value

The yTextureCoord

ssit:txTxtd

Getter for the xTextureCoord attribute

Return value

The xTextureCoord

ssit:tD

Getter for the ID attribute

Return value

The ID

Constructor

A constructor that creates a character instance with its specified attributes

Parameters

id: The id of this char (normally ascii representation of char)

xTextureCoord: X component of the upper left corner of this char on its font-texture

yTextureCoord: Y component of the upper left corner of this char on its font-texture

xOffset: A virtual cursor will be used. This value specifies where to locate this chars vertex depending on the x-offset

yOffset: A virtual cursor will be used. This value specifies where to locate this chars vertex depending on the y-offset

sizeX: The width of this character

sizeY: The height of this character

xAdvance: Which offset receives the virtual cursor after writing this letter

Constructor

Default constructor.

dAFts

This call renders every font stored in the "fonts" vector

AddTxt(std::ssrinstrst:tst:tr:rris:srsirrdtstd:isntsrtsst:tst:tr:rris:srsirrdtstd:sistst:tst:tr:rris:srsirrdtst:r)

This method creates a new text by specifying a std::string and the depth of the text.

Parameters

str: The text you want to add to the render list

depth: The depth for the new text

Return value

The Text handler for that str and font-shader combination symbolized with this class

AddTxt(std::ssrinstrst:tst:tr:rris:srsirrdtstd:isntsrtsst:tst:tr:rris:srsirrdtstd:sistst:tst:tr:rris:srsirrdt)

This method creates a new text by specifying a std::string.

Parameters

str: The text you want to add to the render list

Return value

The Text handler for that str and font-shader combination symbolized with this class

GtFtHsd(std::ssrinstrst:tst:tr:rris:srsirrdtstd:isntsrtsst:tst:tr:rris:srsirrdtstd:sistst:tst:tr:rris:srsirrdtst:tr:rris:sststd::ssrinstrst:tst:tr:rris:srsirrdtstd:isntsrtsst:tst:tr:rris:srsirrdtstd:sistst:tst:tr:rris:srsirrdtst:tr:rris:sst)

The singleton getter of this class. This call is used to get the fonthandler used for a specified font (by fontfiles and shader)

Parameters

pathToFontFiles: This call expects to find an .png image containing the letters and also the .fnt file which holds detailed information about each char on that image

shaderPath: The path to the shader files used for rendering text

Return value

A pointer to the FontHandler used to render texts in this font-shader combination

Drss

The deconstructor of this class deletes all text components since they are not valid without their renderer

GUI.Text

This class is used to handle text on screen. In particular this class is a wrapper to a std::string instance which is than rendered to the screen. Note that this class does not have a public constructor since it has to be initialized using a FontHandler instance.

Methods

Constructor

The constructor of this class. You need to pass the string you want to get rendered and an valid instance of a FontHandler to indicate the font the text gets rendered in.

Parameters

text: The string that gets represented

fontHandler: The font handler that creates this text element

Drss

The deconstructor for this class. Destroys a text component.

nLssTs(ENGNE:G:Txtst:tr:rris:sst*st:tr:rris:srirtDid)

This operator is used to order the text elements by their depth. The text instance with the smaller depth value wins this comparison.

Parameters

b: The text you want to compare against

Return value

True, if the left text element has a smaller depth value. Else false

tTxtsrz(st:r)

Note that the pixel size can vary from screen to screen This sets the textsize using pixels.

Parameters

size: The new text size

GtDt

This returns the current depth for this item (See also SetDepth for more detail).

Return value

returns the current depth

tDt(st:r)

The depth of this component is used to move a text before or behind another GUI item.

Parameters

val: The new depth for this instance

Gttr

This methode returns the string represented by this class

Return value

The string used in this class

AdTxt(std::ssrinstrst:tst:tr:rris:srsirrdtstd:isntsrtsst:tst:tr:rris:srsirrdtstd:sistst:tst:tr:rris:srsirrdt)

This methods adds a string ("appendText") to the string of this class-instance

Parameters

appendText: The text you want to append

UTIL.Rect

A rect providing info about a 2D-position and width and height either in pixels or in screen location (-1 to 1 on the x- and y-axis)

Fields

height

The height of this rect.

width

The width of this rect

y

the Y value of this rect

x

The X value of this rect

Methods

Msit(st:t32st:t32)

Note that the mouse position has to be in the right coordinate system. (See toPixels() and fromPixels()) Returns true if the specified mouse position is inside the rect.

Parameters

mouseX: The X-Coordinat of the mouse position

mouseY: The Y-Coordinat of the mouse position

Return value

True if the passed mouse position is inside the rect, else false.

Msit(:i0x2st:r0x0)

Note that the mouse position has to be in the right coordinate system. (See toPixels() and fromPixels()) Returns true if the specified mouse position is inside the rect.

Parameters

mousePos: The mouse position

Return value

True if the passed mouse position is inside the rect, else false.

Prxs

Converts this rect from Pixel-Coordinats into Screen-Coordinats based on the current display dimensions

tPrxs

Converts this rect from Screen-Coordinats into Pixel-Coordinats based on the current display dimensions

Constructor

creates a new rect with given parameters

Parameters

x: the x position

y: the y position

width: the width for the rect

height: the height for the rect

inScreenCoords: are the passed values in a coord system from -1 to 1

Constructor

Creates a new Rect where every component (x, y, width, height) is initialized with 0.

Texture

This class is a wrapper for using textures. The implementation supports only "*.png" files. Use the SetActivationSlot(...) to set which texture slot you wanna use (GL_TEXTUREi, where i ranges from 0 to (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)).

... //e.g. load texture 
{
	Bind(shader);
	Bind(texture);
	//bind sampler to shader location
	glUniform1i(shader->getUniform("tex"), 0);	//only when the Sampler2D in the shader source code is called "tex"
	... //Render stuff
} // Texture and Shader are unbound automatically

Methods

n:rd

Used to unbind the texture. This call is automated when the BIND(...) macro was used to bind this texture.

n:rd

Used to bind the texture (using the BIND(...) macro defined in the AutoUnbind header.

tAitrstrt(st:t32)

This method sets the slot where the texture is bound to. Valid input-range: GL_TEXTUREi, where i ranges from 0 to (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)

Parameters

value: The slot you want to use.

Constructor

The constructor loads the image and pushes it to the GPU. Supported file extensions: .png

Parameters

path: Path to file (including file extension).

Renderer

This class is used to Render a specified model with a given shader.

Note that neither the Model nor the Shader can be used without this class and get rendered.

Methods

d

This function renders the model using the specified shader to the current context.

Constructor

Creates a new Renderer for a passed shader and a given model.

Parameters

shaderName: The path to the shader

model: A pointer to the model you wanna render

UTIL.AutoUnbind

This class is a wrapper for using the scopewatch. The essential idea is to have a macro (Bind(...)) which can be used to bind a child of this class and gets unbound automatically.

Methods

n:rd

The method used to unbind this object. Has to be implemented!

n:rd

The method used to bind this object. Has to be implemented!

GameObject

A gameobject is a object in the scene. It is used as a collection of components with some additional funcionallity: Each GameObject has a transform component which is used to store the position, the rotation and the scale of that object. GameObjects are also used to handle a parent-child relation of objects (for example useful to make a player object with different attatchments).

Note that not every GameObject has to be visible and support some kind of render. It can also be used to create handlers or some other singletons.

Fields

transform

The Transform component is assigned to each GameObject to store position scale and rotation. Note that the Parent-Child-relation has impact on the calculations taking place in the transform instance.

Methods

Addrd(ENGNE:GsO:jit*)

Adds a child to this gameObject

Parameters

obj: The new child

tPst(ENGNE:GsO:jit*)

Sets the parent for this gameObject

Parameters

obj: the parent for this object

Gtrds

This returns a list of all child gameobjects that are assigned to this gameObject.

Return value

A list of all childs, or an empty list

GtPst

This function returns the parent if existing. If not existing, this returns nullptr.

Return value

The parent gameObject if existing, else nullptr

Addt(ENGNE:t*)

This method is used to assign a component to the GameObject. Note that you have to create a lasting component (using the 'new' macro).

Parameters

comp: The component you want to add.

Example
Component *comp = new RotateObjectComponent();
gameObject->AddComponent(comp);

Constructor

Note that it is strongly advised to create a GameObject using the Instantiate() method offered by the Scene or the component class. This creates a new GameObject with a specified name.

Parameters

name: The name of the new GameObject

Constructor

Note that it is strongly advised to create a GameObject using the Instantiate() method offered by the Scene or the component class. This creates a new GameObject with the empty string as name.

Transform

This class is a part of each GameObject which stores rotation position and a three dimensional scale value for the object. It also provides a methods for creating (for the rendering of the object) the model matrix.

Fields

scale

The scale value of the Transform and the corresponding GameObject

rotation

The rotation of the Transform and the corresponding GameObject

position

The position of the Transform and the corresponding GameObject

Methods

GtPsMstrx

This method returns a matrix that positions the object using this Transform

Return value

The position matrix

GttstrMstrx

This method returns a matrix that rotates the object using this Transform

Return value

The rotation matrix

GtisMstrx

This method returns a matrix that scales the object using this Transform

Return value

The scale matrix

GtMdMstrx

This method returns a model matrix for this transform object. Therefore the position matrix the rotation matrix and the scale matrix is multiplied. The parent transform is used to calculate this matrix (if and only if existing).

Return value

Model matrix (with parent transform)

Constructor

Note that this class can be used without a GameObject but will in this case not be used in the scene. This creates a new Transform object where position and rotation can be specified (by default they are 0). This constructor can also be used with a specified scale value (which by default is 1).

Parameters

pos: The three dimensional position of the object

rot: The three dimensional rotation of the object

scale: The three dimensional scale of the object

Component

This class is abstract and has to be inherited. It provides the standard functions as Start() or Update() and when added to an active GameObject instance is called by the engine. It also provides basic functionality to the engine like a ShowMouse function.

Methods

Dst

This function is called when the component gets destroyed.

d

This function is called to render the scene (once a frame). Is called AFTER LateUpdate().

Lstdst

This function is called each frame to update the component (and/or scene). Is called AFTER Update().

dst

This function is called each frame to update the component (and/or scene). Is called as first update function each frame.

tst

This function is called in the following frame after the component was created Is called AFTER Awake().

Awsk

This function is called in the following frame after the component was created. Is called BEFORE Start().

tMsPsrtr(st:t32st:t32)

Sets the mouse position relative to the window. Note that the mouse position can be set when the mouse is not showing.

Parameters

x: The target mouse position on the X-Axis in pixel.

y: The target mouse position on the Y-Axis in pixel.

wMs(st:s)

Can be used to en-/disable the mouse pointer while the mouse is hovering over the window opened by the Game-Engine.

Parameters

showMouse: If true the mouse is shown, if false it is not.

ststrst(std::ssrinstrst:tst:tr:rris:srsirrdtstd:isntsrtsst:tst:tr:rris:srsirrdtstd:sistst:tst:tr:rris:srsirrdt)

Creates a new gameObject with a specified name. This GameObject is introduced to the current scene.

Parameters

name: The name for the new GameObject

Return value

A pointer to the empty gameObject with the name.

ststrst

Creates a new gameObject with name "". This GameObject is introduced to the current scene.

Return value

A pointer to the empty gameObject.

GttGsO:jit

Returns a pointer to the gameObject the component is running on/connected to.

Return value

A pointer to the gameObject.

Gttss

Returns a pointer to the current scene camera. Usefull e.g. to update the cameras location or rotation.

Return value

A pointer to the current/active camera.

Gtti

Returns a handle to the active scene (to access their functionalities).

Return value

A pointer to the active/current scene.

Clone this wiki locally