FWindowCurrentInfo

namespace marengine

Enums

enum EWindowContextType

Values:

enumerator NONE
enumerator GLFW
class FWindow : public IWindow

FWindow class is first implementation of IWindow, that other implementations of IWindow should derive from.

Subclassed by FWindowGLFW, FWindowSDL

Public Functions

void setClearColor(maths::vec3 clearColor) final

Sets clear color.

Parameters
  • clearColor: value, with which screen will be cleared.

uint32 getWidth() const final

Returns window’s viewport size on x-axis.

Return

window size on x-axis.

uint32 getHeight() const final

Returns window’s viewport size on y-axis.

Return

window size on y-axis.

float getMousePositionX() const final

Returns Mouse position at x-axis.

Return

Mouse position at x-axis.

float getMousePositionY() const final

Returns Mouse position at y-axis.

Return

Mouse position at y-axis.

float getScrollX() const final

Returns scroll value at x-axis.

Return

scroll value at x-axis.

float getScrollY() const final

Returns scroll value at y-axis.

Return

scroll value at y-axis.

Protected Attributes

FWindowCurrentInfo p_currentInfo
struct FWindowCurrentInfo

FWindowCurrentInfo is a structure storage for all current information about window. All implementations of IWindow should contain this structure and fill it during runtime.

Public Members

maths::vec3 clearColor
uint32 width = {800}
uint32 height = {600}
float xScroll = {0.f}
float yScroll = {0.f}
float xMousePos = {0.f}
float yMousePos = {0.f}
class IWindow

IWindow is a interface class for Window in MAREngine. Every derived implementation of IWindow should properly implement those methods for proper run.

Subclassed by FWindow

Public Functions

bool open(uint32 width, uint32 height, const char *name) = 0

Method is responsible for opening window with given width, height and its name.

Return

True if window opened correctly, false otherwise

Parameters
  • width: width of window

  • height: height of window

  • name: name of window, that shall be displayed

void close() = 0

Closes current window instance. Remember, it does not terminate library, closes window!

bool initializeLibrary() = 0

Initializes implementation library of window instance. It is called during MAREngine’s startup.

Return

True if window’s library initialized correctly, false otherwise

void terminateLibrary() = 0

Terminates window’s library. Called during MAREngine’s termination.

void initEditorGuiLibrary() = 0

Initializes GUI Editor Library with window instance, so that it can be used correctly. It is called during editor gui initialization.

void beginNewFrameEditorGuiLibrary() = 0

Begins new frame at editor GUI library. Sometimes these methods need to have access to window instance, so that it should be implemented there. Called during every new frame.

void terminateEditorGuiLibrary() = 0

Terminates EditorGUI library, so that window afterwards can be closed correctly.

bool isGoingToClose() = 0

Checks if window is going to close after that frame and returns the result.

Return

True, if window is going to close, false otherwise

void setVerticalSync(int32 vsSetValue) = 0

Sets vertical synchronization (decreases FPS if set on!).

Parameters
  • vsSetValue: vsSetValue equal to 1 sets VS. 0 disables it.

void setClearColor(maths::vec3 clearColor) = 0
void clear() const = 0

Clears screen.

void swapBuffers() = 0

Swaps buffers and polls event.

uint32 getWidth() const = 0

Returns window’s viewport size on x-axis.

Return

window size on x-axis.

uint32 getHeight() const = 0

Returns window’s viewport size on y-axis.

Return

window size on y-axis.

bool isKeyPressed(int32 key) const = 0

Checks, if given key at keyboard was pressed and returns result. For correct key value check Window/buttons_def.h file.

Return

True, if keyboard key was pressed, false otherwise.

Parameters
  • key: Keyboard value, to be checked if it was pressed.

bool isMousePressed(int32 key) const = 0

Checks, if given key at mouse was pressed and returns result. For correct key value check Window/buttons_def.h file.

Return

True, if mouse key was pressed, false otherwise.

Parameters
  • key: Mouse value, to be checked if it was pressed.

float getMousePositionX() const = 0

Returns Mouse position at x-axis.

Return

Mouse position at x-axis.

float getMousePositionY() const = 0

Returns Mouse position at y-axis.

Return

Mouse position at y-axis.

float getScrollX() const = 0

Returns scroll value at x-axis.

Return

scroll value at x-axis.

float getScrollY() const = 0

Returns scroll value at y-axis.

Return

scroll value at y-axis.