BARE2D
BARE2D::Window Class Reference

It's a graphical window, holds the contexts for GL and SDL. More...

#include <Window.hpp>

+ Collaboration diagram for BARE2D::Window:

Public Member Functions

 Window ()
 
 ~Window ()
 
void create (unsigned int flags)
 This is a graphical window. It holds information about the GL context, as well as the SDL window context. Takes some flags on creation (SDL_WindowFlags): More...
 
void setTitle (std::string newTitle)
 Sets the title of the window. More...
 
void setSize (unsigned int width, unsigned int height)
 Sets the size of the window (defaults to 600x400) More...
 
void swapBuffer ()
 Swaps the buffer of the SDL window - used to draw to one while the other displays, so no flickering is seen. More...
 
unsigned int getWidth () const
 Returns the width of the window. More...
 
unsigned int getHeight () const
 Returns the height of the window. More...
 

Private Attributes

SDL_Window * m_SDLWindow = nullptr
 
SDL_GLContext m_GLContext = nullptr
 
unsigned int m_width = 600
 
unsigned int m_height = 400
 
std::string m_title = "BARE2D Window"
 

Detailed Description

It's a graphical window, holds the contexts for GL and SDL.

Definition at line 13 of file Window.hpp.

Constructor & Destructor Documentation

◆ Window()

BARE2D::Window::Window ( )

Definition at line 9 of file Window.cpp.

◆ ~Window()

BARE2D::Window::~Window ( )

Definition at line 13 of file Window.cpp.

References m_GLContext, and m_SDLWindow.

Member Function Documentation

◆ create()

void BARE2D::Window::create ( unsigned int  flags)

This is a graphical window. It holds information about the GL context, as well as the SDL window context. Takes some flags on creation (SDL_WindowFlags):

  • SDL_WINDOW_FULLSCREEN
  • FULLSCREN_DESKTOP
  • OPENGL
  • VULKAN
  • SHOWN
  • HIDDEN
  • BORDERLESS
  • RESIZABLE
  • MIN/MAXIMIZED
  • INPUT_GRABBED
  • INPUT_FOCUS
  • MOUSE_FOCUS
  • FOREIGN
  • ALLOW_HIGHDPI
  • MOUSE_CAPTURE
  • ALWAYS_ON_TOP
  • SKIP_TASKBAR
  • UTILITY
  • TOOLTIP
  • POPUP_MENU These can be ORed together to transfer them to this function
    Returns
    Returns an error (if one is created)

Definition at line 20 of file Window.cpp.

References BARE2D::GLEW_FAILURE, m_GLContext, m_height, m_SDLWindow, m_title, m_width, BARE2D::SDL_FAILURE, and BARE2D::throwFatalError().

Referenced by BARE2D::App::init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHeight()

unsigned int BARE2D::Window::getHeight ( ) const

Returns the height of the window.

Definition at line 97 of file Window.cpp.

References m_height.

Referenced by BARE2D::App::draw().

+ Here is the caller graph for this function:

◆ getWidth()

unsigned int BARE2D::Window::getWidth ( ) const

Returns the width of the window.

Definition at line 93 of file Window.cpp.

References m_width.

Referenced by BARE2D::App::draw().

+ Here is the caller graph for this function:

◆ setSize()

void BARE2D::Window::setSize ( unsigned int  width,
unsigned int  height 
)

Sets the size of the window (defaults to 600x400)

Parameters
width
height

Definition at line 77 of file Window.cpp.

References m_height, m_SDLWindow, and m_width.

◆ setTitle()

void BARE2D::Window::setTitle ( std::string  newTitle)

Sets the title of the window.

Parameters
newTitleThe new title to be set!

Definition at line 72 of file Window.cpp.

References m_SDLWindow, and m_title.

◆ swapBuffer()

void BARE2D::Window::swapBuffer ( )

Swaps the buffer of the SDL window - used to draw to one while the other displays, so no flickering is seen.

Definition at line 89 of file Window.cpp.

References m_SDLWindow.

Referenced by BARE2D::App::run().

+ Here is the caller graph for this function:

Field Documentation

◆ m_GLContext

SDL_GLContext BARE2D::Window::m_GLContext = nullptr
private

Definition at line 76 of file Window.hpp.

Referenced by create(), and ~Window().

◆ m_height

unsigned int BARE2D::Window::m_height = 400
private

Definition at line 78 of file Window.hpp.

Referenced by create(), getHeight(), and setSize().

◆ m_SDLWindow

SDL_Window* BARE2D::Window::m_SDLWindow = nullptr
private

Definition at line 75 of file Window.hpp.

Referenced by create(), setSize(), setTitle(), swapBuffer(), and ~Window().

◆ m_title

std::string BARE2D::Window::m_title = "BARE2D Window"
private

Definition at line 79 of file Window.hpp.

Referenced by create(), and setTitle().

◆ m_width

unsigned int BARE2D::Window::m_width = 600
private

Definition at line 78 of file Window.hpp.

Referenced by create(), getWidth(), and setSize().


The documentation for this class was generated from the following files: