Skip to content

Window system

Merijn Hendriks edited this page Mar 14, 2019 · 14 revisions

About

A simple window system.

Information

You can have only 1 window.

Dependencies

  • glad (c/c++, core profile, generate loader)
  • glfw 3.2.1
  • automata_const.h

OpenGL

The window system uses glad as OpenGL loader.

A window has an OpenGL context. The OpenGL version of this context is defined in automata_const.h:

#define AUTOMATA_OPENGL_VERSION_MAJOR 3
#define AUTOMATA_OPENGL_VERSION_MINOR 3

Definition

All window structs and functions are defined in automata_window.h.

Structures

struct AutomataWindow {
    GLFWwindow *window;
    unsigned int width;
    unsigned int height;
    const char *title;
};

Internal use only. The window structure. window: the GLFW window. width: the window width. height: the window height. title: the window title.

Functions

void automataWindowInit();

Initializes the window system.

void automataWindowCreate(unsigned int width, unsigned int height, const char *title);

Creates the window. width: the window width. height: the window height. title: the window title.

void automataWindowTerminate();

Terminates the window system.

int automataWindowIsAlive();

Returns if the window is alive.

void automataWindowUpdate();

Updates the window.

unsigned int automataWindowGetWidth();

Returns the current window width.

unsigned int automataWindowGetHeight();

Returns the current window height.

const char *automataWindowGetTitle();

Returns the current window title.

void automataWindowSetTitle(const char *title);

Changes the window title. title: the new window title

void automataWindowSetSize(unsigned int width, unsigned int height);

Resizes the window. width: the new window width. height: the new window height.

void automataWindowCallbackResize(GLFWwindow* glfwWindow, int width, int height);

Internal use only. Called when a window is resized.

Clone this wiki locally