cangine
Loading...
Searching...
No Matches
Namespaces | Classes | Enumerations | Functions | Variables
cangine Namespace Reference

Namespaces

namespace  Colors
 Predefined commonly used opaque colors.
 
namespace  Exception
 Exception types thrown by the engine.
 

Classes

class  AudioManager
 Singleton class that manages audio playback. More...
 
class  Button
 Clickable button game object with a text label. More...
 
class  ButtonComponent
 Component providing clickable-button behavior and visuals. More...
 
class  Camera
 Game object representing the scene camera. More...
 
class  CameraComponent
 Component marking its game object as the active camera. More...
 
class  CangineApp
 Base application class that owns the window and main loop. More...
 
struct  Character
 A single cached glyph: its texture and layout metrics. More...
 
struct  Color
 RGBA color stored as normalized floating-point components. More...
 
struct  Dimensions
 Holds an integer width/height pair. More...
 
class  EBO
 Wraps an OpenGL Element Buffer Object (index buffer). More...
 
struct  Font
 A loaded font face plus its cache of rasterized glyphs. More...
 
class  GameObject
 Base class for everything that lives in the scene. More...
 
class  IComponent
 Base interface for all components attached to a GameObject. More...
 
class  Input
 Static facade for keyboard input queries and event handlers. More...
 
class  InputField
 Editable text-field game object. More...
 
class  InputFieldComponent
 Editable single-line text input field. More...
 
struct  KeyEvent
 A keyboard event: which key and what happened to it. More...
 
class  Label
 Convenience game object that displays a line of text. More...
 
class  Mouse
 Singleton tracking mouse state and dispatching mouse events. More...
 
struct  MouseEvent
 A mouse event carrying its type, button, position and scroll offset. More...
 
class  ObjectManager
 Singleton registry that owns and updates all game objects. More...
 
class  Panel
 Container game object that groups and positions child objects. More...
 
struct  PanelChild
 A child object of a panel together with its offset from the panel. More...
 
class  PanelComponent
 Container component that positions child objects relative to itself. More...
 
class  Position
 Helper for converting screen-space positions into normalized device coordinates. More...
 
class  PrimitiveRenderer
 Batches and draws untextured geometric primitives. More...
 
class  QuadRenderer
 Batched renderer for textured quads (rectangles). More...
 
class  QuadRendererComponent
 Component that draws its game object as a textured rectangle. More...
 
struct  Rectangle
 An axis-aligned rectangle with a position, size and color. More...
 
class  RenderSystem
 Singleton aggregating the engine's renderers. More...
 
class  Shader
 Wraps a compiled and linked OpenGL shader program. More...
 
struct  Sound
 Describes an audio source: its file path, name and volume. More...
 
class  TextRenderer
 Singleton that loads fonts and renders text via FreeType. More...
 
class  TextRendererComponent
 Component that renders a text string, optionally over a background. More...
 
class  Texture
 Wraps an OpenGL texture object. More...
 
class  Transform
 Component holding an object's position, rotation and scale. More...
 
struct  Triangle
 A triangle defined by three vertices. More...
 
class  VAO
 Wraps an OpenGL Vertex Array Object. More...
 
class  VBO
 Wraps an OpenGL Vertex Buffer Object. More...
 
struct  Vector2
 Two-component floating-point vector. More...
 
struct  Vector3
 Three-component floating-point vector. More...
 
struct  Vertex
 A single renderable vertex: position, color and texture coordinate. More...
 
class  Window
 Owns the application window, OpenGL context and the frame loop. More...
 

Enumerations

enum class  Key {
  Unknown = -1 , A , B , C ,
  D , E , F , G ,
  H , I , J , K ,
  L , M , N , O ,
  P , Q , R , S ,
  T , U , V , W ,
  X , Y , Z , Num0 ,
  Num1 , Num2 , Num3 , Num4 ,
  Num5 , Num6 , Num7 , Num8 ,
  Num9 , F1 , F2 , F3 ,
  F4 , F5 , F6 , F7 ,
  F8 , F9 , F10 , F11 ,
  F12 , F13 , F14 , F15 ,
  F16 , F17 , F18 , F19 ,
  F20 , F21 , F22 , F23 ,
  F24 , Up , Down , Left ,
  Right , Escape , Enter , Tab ,
  Space , Backspace , Insert , Delete ,
  Pause , CapsLock , ScrollLock , NumLock ,
  PrintScreen , Menu , LeftShift , RightShift ,
  LeftCtrl , RightCtrl , LeftAlt , RightAlt ,
  LeftSuper , RightSuper , ContextMenu , Numpad0 ,
  Numpad1 , Numpad2 , Numpad3 , Numpad4 ,
  Numpad5 , Numpad6 , Numpad7 , Numpad8 ,
  Numpad9 , NumpadDecimal , NumpadDivide , NumpadMultiply ,
  NumpadSubtract , NumpadAdd , NumpadEnter , NumpadEqual ,
  Minus , Equal , LeftBracket , RightBracket ,
  Backslash , Semicolon , Apostrophe , Comma ,
  Period , Slash , GraveAccent
}
 Platform-independent keyboard key identifiers. More...
 
enum class  KeyEventType { Down , Up , Repeat , Unknown }
 The kind of keyboard event that occurred. More...
 
enum class  MouseButton {
  Button1 , Button2 , Button3 , Button4 ,
  Button5 , Button6 , Button7 , Button8 ,
  Left = Button1 , Right = Button2 , Middle = Button3
}
 Mouse button identifiers, with named aliases for the common three. More...
 
enum class  MouseEventType {
  CursorMove , CursorEnter , CursorLeave , MouseClick ,
  MouseRelease , Scroll
}
 The kind of mouse event that occurred. More...
 
enum  RendererType { QUADRENDERER , PRIMITIVERENDERER }
 Identifies which primitive renderer backend to use. More...
 

Functions

void init ()
 Initializes engine-wide state (must be called before use).
 
void terminate ()
 Tears down engine-wide state.
 
Key translateGLFWKey (int key)
 Translates a raw GLFW key code into a Key.
 
KeyEventType getKeyEventType (int glfwKeyEvent)
 Translates a raw GLFW key action into a KeyEventType.
 
Vector2 _getCursorPos (GLFWwindow *window)
 
void resizeCallback (GLFWwindow *window, int w, int h)
 GLFW framebuffer resize callback.
 
std::vector< uint32_t > utf8_to_codepoints (const std::string &str)
 Decodes a UTF-8 string into a list of Unicode codepoints.
 
constexpr bool operator>> (const Vector2 &vec, const Rectangle &rect) noexcept
 Point-in-rectangle test (axis-aligned, untransformed).
 
constexpr bool operator>> (const Rectangle &rect, const Vector2 &vec) noexcept
 Point-in-rectangle test with reversed operand order.
 
constexpr bool operator>> (const Rectangle &r1, const Rectangle &r2) noexcept
 Axis-aligned overlap test between two rectangles.
 
Triangle makeTriangle (const Vector3 &a, const Vector3 &b, const Vector3 &c, const Color &color) noexcept
 Builds a triangle from three positions sharing a single color.
 
std::array< Triangle, 2 > rectToTriangle (const Rectangle &r) noexcept
 Splits a rectangle into the two triangles that cover it.
 

Variables

Mouse * mouse = nullptr
 

Detailed Description

CameraComponent and CameraObject is bascially a singleton and does nothing. Camera game objects adds Camera to itself automatically just to tell the engine

That's basically it.

Actual camera behaviour is implemented in "utils/position.cpp"

Panel offsets it's position to children.

Label is just putting TextRendererComponent to itself but makes easier to initialize it and saves you from writing more code.

Enumeration Type Documentation

◆ Key

enum class cangine::Key
strong

Platform-independent keyboard key identifiers.

GLFW key codes are translated into these values so engine code does not depend on the windowing backend.

Enumerator
Unknown 

Unrecognized or unmapped key.

A 
B 
C 
D 
E 
F 
G 
H 
I 
J 
K 
L 
M 
N 
O 
P 
Q 
R 
S 
T 
U 
V 
W 
X 
Y 
Z 
Num0 
Num1 
Num2 
Num3 
Num4 
Num5 
Num6 
Num7 
Num8 
Num9 
F1 
F2 
F3 
F4 
F5 
F6 
F7 
F8 
F9 
F10 
F11 
F12 
F13 
F14 
F15 
F16 
F17 
F18 
F19 
F20 
F21 
F22 
F23 
F24 
Up 
Down 
Left 
Right 
Escape 
Enter 
Tab 
Space 
Backspace 
Insert 
Delete 
Pause 
CapsLock 
ScrollLock 
NumLock 
PrintScreen 
Menu 
LeftShift 
RightShift 
LeftCtrl 
RightCtrl 
LeftAlt 
RightAlt 
LeftSuper 
RightSuper 
ContextMenu 
Numpad0 
Numpad1 
Numpad2 
Numpad3 
Numpad4 
Numpad5 
Numpad6 
Numpad7 
Numpad8 
Numpad9 
NumpadDecimal 
NumpadDivide 
NumpadMultiply 
NumpadSubtract 
NumpadAdd 
NumpadEnter 
NumpadEqual 
Minus 
Equal 
LeftBracket 
RightBracket 
Backslash 
Semicolon 
Apostrophe 
Comma 
Period 
Slash 
GraveAccent 

◆ KeyEventType

enum class cangine::KeyEventType
strong

The kind of keyboard event that occurred.

Enumerator
Down 

Key was pressed this frame.

Up 

Key was released this frame.

Repeat 

Key is held and generating auto-repeat events.

Unknown 

Unrecognized event type.

◆ MouseButton

enum class cangine::MouseButton
strong

Mouse button identifiers, with named aliases for the common three.

Enumerator
Button1 

First button.

Button2 

Second button.

Button3 

Third button.

Button4 

Fourth button.

Button5 

Fifth button.

Button6 

Sixth button.

Button7 

Seventh button.

Button8 

Eighth button.

Left 

Left button (alias of Button1).

Right 

Right button (alias of Button2).

Middle 

Middle button (alias of Button3).

◆ MouseEventType

enum class cangine::MouseEventType
strong

The kind of mouse event that occurred.

Enumerator
CursorMove 

Cursor moved within the window.

CursorEnter 

Cursor entered the window.

CursorLeave 

Cursor left the window.

MouseClick 

A button was pressed.

MouseRelease 

A button was released.

Scroll 

The scroll wheel moved.

◆ RendererType

Identifies which primitive renderer backend to use.

Enumerator
QUADRENDERER 

Textured quad renderer.

PRIMITIVERENDERER 

Untextured primitive renderer.

Function Documentation

◆ _getCursorPos()

Vector2 cangine::_getCursorPos ( GLFWwindow *  window)

◆ getKeyEventType()

KeyEventType cangine::getKeyEventType ( int  glfwKeyEvent)

Translates a raw GLFW key action into a KeyEventType.

Parameters
glfwKeyEventGLFW key action code.
Returns
The corresponding KeyEventType.

◆ init()

void cangine::init ( )

Initializes engine-wide state (must be called before use).

◆ makeTriangle()

Triangle cangine::makeTriangle ( const Vector3 &  a,
const Vector3 &  b,
const Vector3 &  c,
const Color &  color 
)
inlinenoexcept

Builds a triangle from three positions sharing a single color.

Parameters
aFirst corner position.
bSecond corner position.
cThird corner position.
colorColor applied to all three vertices.
Returns
The constructed triangle.

◆ operator>>() [1/3]

constexpr bool cangine::operator>> ( const Rectangle &  r1,
const Rectangle &  r2 
)
inlineconstexprnoexcept

Axis-aligned overlap test between two rectangles.

Parameters
r1First rectangle.
r2Second rectangle.
Returns
true if the rectangles overlap (ignoring rotation/scale).

◆ operator>>() [2/3]

constexpr bool cangine::operator>> ( const Rectangle &  rect,
const Vector2 &  vec 
)
inlineconstexprnoexcept

Point-in-rectangle test with reversed operand order.

Parameters
rectAxis-aligned rectangle.
vecPoint to test.
Returns
true if the point is within the rectangle bounds.

◆ operator>>() [3/3]

constexpr bool cangine::operator>> ( const Vector2 &  vec,
const Rectangle &  rect 
)
inlineconstexprnoexcept

Point-in-rectangle test (axis-aligned, untransformed).

Parameters
vecPoint to test.
rectAxis-aligned rectangle centered on rect.pos.
Returns
true if the point is within the rectangle bounds.

◆ rectToTriangle()

std::array< Triangle, 2 > cangine::rectToTriangle ( const Rectangle &  r)
inlinenoexcept

Splits a rectangle into the two triangles that cover it.

Parameters
rRectangle to triangulate.
Returns
An array of two triangles forming the rectangle.

◆ resizeCallback()

void cangine::resizeCallback ( GLFWwindow *  window,
int  w,
int  h 
)

GLFW framebuffer resize callback.

Parameters
windowWindow that was resized.
wNew framebuffer width in pixels.
hNew framebuffer height in pixels.

◆ terminate()

void cangine::terminate ( )

Tears down engine-wide state.

◆ translateGLFWKey()

Key cangine::translateGLFWKey ( int  key)

Translates a raw GLFW key code into a Key.

Parameters
keyGLFW key code.
Returns
The corresponding Key, or Key::Unknown if unmapped.

◆ utf8_to_codepoints()

std::vector< uint32_t > cangine::utf8_to_codepoints ( const std::string &  str)

Decodes a UTF-8 string into a list of Unicode codepoints.

Parameters
strUTF-8 encoded string.
Returns
Vector of decoded codepoints.

Variable Documentation

◆ mouse

Mouse* cangine::mouse = nullptr