Middle Europe Productions Library  alpha 1.3.3
Public Types | Public Member Functions | List of all members
MEP::BaseWindow Class Reference

A basic class for the BaseWindow. More...

#include <BaseWindow.h>

Inheritance diagram for MEP::BaseWindow:
MEPtools::GroupManager< MEPtools::ToRender, MEPtools::ToRender, std::list< MEPtools::ToRender > > MEP::WindowView MEP::Template::Hub MEP::Template::Loading

Public Types

enum  Status {
  Status::LowEntrance = 0, Status::Entrance = -1, Status::Exit = -2, Status::LowExit = -3,
  Status::InProgress = -4, Status::Main = -5, Status::NullAction = -6
}
 

Public Member Functions

 BaseWindow (const unsigned int ID)
 
 BaseWindow (const unsigned int ID, const sf::View &view, const sf::View &master)
 
virtual bool render (sf::RenderWindow &Window)
 
void onResize (const sf::Vector2u &new_res)
 
virtual void update (sf::Time &currentTime)
 
virtual void beforeUpdate (sf::Time &)
 
virtual void updateRunning (sf::Time &currentTime)
 
virtual void updateEntrance (sf::Time &currentTime)
 
virtual void updateExit (sf::Time &currentTime)
 
virtual void afterUpdate (sf::Time &)
 
virtual void handleEvent (sf::RenderWindow &Window, sf::Event &event)
 
const StatusgetStatus ()
 
void changeStatus (const Status status)
 
void newObject (DataPackage object)
 
void newObject (MEP::Drawable *object)
 
void newObject (MEP::Drawable &object)
 
template<typename ... Values>
void newObjects (Values &&... values)
 
void debugOutput (std::ostream &out)
 
unsigned int getID () const
 
bool operator== (const unsigned int ID) const
 
bool operator== (const BaseWindow &x) const
 
virtual ~BaseWindow ()
 
- Public Member Functions inherited from MEPtools::GroupManager< MEPtools::ToRender, MEPtools::ToRender, std::list< MEPtools::ToRender > >
 GroupManager ()=default
 
bool _insert (MEP::U_int32 ID, MEP::U_int32 group, MEPtools::ToRender value)
 
MEPtools::ToRender_get (MEP::U_int32 ID, MEP::U_int32 group) const
 
std::list< MEPtools::ToRender > & _getGroup (MEP::U_int32 group)
 
bool _deleteGroup (MEP::U_int32 group)
 
bool _deleteElement (MEP::U_int32 ID, MEP::U_int32 group)
 
void _execute (Method method)
 
bool _execute (Method method, MEP::U_int32 group)
 
void _execute (Method method) const
 
bool _execute (Method method, MEP::U_int32 group) const
 
void _debugOutput (std::ostream &out, const char *before="", const char *after="") const
 
void _debugOutput (std::ostream &out, Out method) const
 
unsigned int _size () const
 
bool _empty () const
 
void _clear ()
 
- Public Member Functions inherited from MEP::WindowView
 WindowView ()=default
 
 WindowView (const sf::View &view, const sf::View &master)
 
void grabWindow ()
 
void releaseWindow ()
 
void moveViewChange (const sf::Vector2i &change)
 
bool isGrabbed () const
 
bool customView () const
 
const sf::View & getView () const
 
void setView (const sf::View &view)
 
virtual void moveView (sf::RenderWindow &Window)
 
const sf::View & getMasterView () const
 

Additional Inherited Members

- Protected Attributes inherited from MEP::WindowView
sf::Vector2i m_windowPossChange
 
bool m_grabbedWindow = false
 
sf::View m_view
 
const sf::View * m_appView = nullptr
 
bool isCustomViewEnabled = false
 

Detailed Description

A basic class for the BaseWindow.

All of the Windows added to the MEP::Template::Application are expected to be a MEP::BaseWindow objects.

Member Enumeration Documentation

◆ Status

Enumerator
LowEntrance 

In this state all of the MEP::Animation with RunAtLowEntry or RunAtLowEntryAndEnd are activated. Then window enters InProgress state.

Entrance 

In this state all of the MEP::Animation with RunAtEntry or RunAtEntryAndEnd are activated. Then window enters Main state.

Exit 

In this state all of the MEP::Objects with RunAtEnd or RunAtEntryAndEnd are activated and Window wait for them to finish.

LowExit 

In this state all of the MEP::Animation with RunAtLowEntry or RunAtLowEntryAndEnd are activated and Window wait for them to finish.

InProgress 

In this state window is being rendered.

Main 

In this state window is being rendered and events from it are handled.

NullAction 

In this state window is not doing anything.

Constructor & Destructor Documentation

◆ BaseWindow() [1/2]

MEP::BaseWindow::BaseWindow ( const unsigned int  ID)
inline

Constructor of a BaseWindow

Parameters
[in]id: Window identifier

◆ BaseWindow() [2/2]

MEP::BaseWindow::BaseWindow ( const unsigned int  ID,
const sf::View &  view,
const sf::View &  master 
)
inline

Constructor of a BaseWindow

Parameters
[in]id: Window identifier @patam[in] view : Input view of the window. @patam[in] master : Main window view.

◆ ~BaseWindow()

virtual MEP::BaseWindow::~BaseWindow ( )
inlinevirtual

Member Function Documentation

◆ afterUpdate()

virtual void MEP::BaseWindow::afterUpdate ( sf::Time &  )
inlinevirtual

If you dont want to ovveride update just use this function. To update things after update call.

Parameters
[in]currontTime: Current global time.

Reimplemented in MEP::Template::Loading.

◆ beforeUpdate()

virtual void MEP::BaseWindow::beforeUpdate ( sf::Time &  )
inlinevirtual

If you dont want to ovveride update just use this function. To update things before update call.

Parameters
[in]currontTime: Current global time.

◆ changeStatus()

void MEP::BaseWindow::changeStatus ( const Status  status)
inline

Changes the status of a window.

Parameters
[in]status: MEP::Status

◆ debugOutput()

void MEP::BaseWindow::debugOutput ( std::ostream &  out)
inline

◆ getID()

unsigned int MEP::BaseWindow::getID ( ) const
inline

Outputs an ID of a MEP::Window::BaseWindow

Returns
: ID

◆ getStatus()

const Status& MEP::BaseWindow::getStatus ( )
inline

Outputs the status of a window.

Returns
MEP::Status

◆ handleEvent()

void MEP::BaseWindow::handleEvent ( sf::RenderWindow &  Window,
sf::Event &  event 
)
inlinevirtual

Base handle events method.

Parameters
[in]Window: sf::RenderWindow.
[in]event: sf::Event

Reimplemented in MEP::Template::Hub.

◆ newObject() [1/3]

void MEP::BaseWindow::newObject ( DataPackage  object)
inline

Adds a new MEP::Drawable to the main scope.

Parameters
[in]MEP::Drawable*

◆ newObject() [2/3]

void MEP::BaseWindow::newObject ( MEP::Drawable object)
inline

Adds a new MEP::Drawable to the main scope.

Parameters
[in]MEP::Drawable&

◆ newObject() [3/3]

void MEP::BaseWindow::newObject ( MEP::Drawable object)
inline

Adds a new MEP::Drawable to the main scope.

Parameters
[in]MEP::Drawable*

◆ newObjects()

template<typename ... Values>
void MEP::BaseWindow::newObjects ( Values &&...  values)
inline

Deletes all MEP::Objects in the MEP::Window::BaseWindow

◆ onResize()

void MEP::BaseWindow::onResize ( const sf::Vector2u &  new_res)
inline

Updates the position when window is resized.

◆ operator==() [1/2]

bool MEP::BaseWindow::operator== ( const BaseWindow x) const
inline

◆ operator==() [2/2]

bool MEP::BaseWindow::operator== ( const unsigned int  ID) const
inline

◆ render()

virtual bool MEP::BaseWindow::render ( sf::RenderWindow &  Window)
inlinevirtual

Base render method.

Parameters
[in]Window: RenderWindow object.
Returns
True if non of the window elements need a rebuild, false when atleast one element could not be rendered.

◆ update()

void MEP::BaseWindow::update ( sf::Time &  currentTime)
inlinevirtual

Base update method.

Parameters
[in]currontTime: Current global time.

◆ updateEntrance()

void MEP::BaseWindow::updateEntrance ( sf::Time &  currentTime)
inlinevirtual

This is a classic update it executes if window has Entrance tag.

Parameters
[in]currontTime: Current global time.

◆ updateExit()

void MEP::BaseWindow::updateExit ( sf::Time &  currentTime)
inlinevirtual

This is a classic update it executes if window has Exit tag.

Parameters
[in]currontTime: Current global time.

◆ updateRunning()

void MEP::BaseWindow::updateRunning ( sf::Time &  currentTime)
inlinevirtual

This is a classic update it executes if window has Main or InProgress tag.

Parameters
[in]currontTime: Current global time.