Visual Computing Library
Loading...
Searching...
No Matches
vcl::RenderApp< WindowManagerT, CanvasT, Drawers > Class Template Reference

The RenderApp class is a template class that combines a canvas, a window manager, and a set of drawers, allowing them to work together and communicate with each other. More...

#include <vclib/render/render_app.h>

Inheritance diagram for vcl::RenderApp< WindowManagerT, CanvasT, Drawers >:

Classes

class  CNV
 The RenderApp::CNV inner class is an Attorney that allow access to some private member functions of the RenderApp class to the CanvasType class. More...
 
class  DRW
 The RenderApp::DRW inner class is an Attorney that allow access to some private member functions of the RenderApp class to the Drawer classes. More...
 
class  WM
 The RenderApp::WM inner class is an Attorney that allow access to some private member functions of the RenderApp class to the WindowManagerType class. More...
 

Public Types

using ParentType = WindowManagerType::ParentType
 

Public Member Functions

 RenderApp (ParentType *parent=nullptr)
 
 RenderApp (const std::string &windowTitle, uint width=1024, uint height=768, ParentType *parent=nullptr)
 

Private Types

using WindowManagerType = WindowManagerT< RenderApp >
 
using CanvasType = CanvasT< RenderApp >
 

Private Member Functions

template<typename D , typename... Others>
void callEventFunForDrawers (auto lambda)
 Calls a lambda function - that represents an event - for every Drawer object listed in the template parameter pack.
 
void callEventFunForDrawers (auto lambda)
 
void wmInit ()
 
void wmResize (uint width, uint height)
 
void wmPaint ()
 
void wmSetModifiers (const KeyModifiers &modifiers)
 
void wmKeyPress (Key::Enum key)
 
void wmKeyRelease (Key::Enum key)
 
void wmMouseMove (double x, double y)
 
void wmMousePress (MouseButton::Enum button, double x, double y)
 
void wmMouseRelease (MouseButton::Enum button, double x, double y)
 
void wmMouseDoubleClick (MouseButton::Enum button, double x, double y)
 
void wmMouseScroll (double x, double y)
 
void cnvDraw ()
 
void cnvDrawContent ()
 
void cnvPostDraw ()
 
voiddWindowPtr ()
 
vcl::Point2< uintdCanvasSize () const
 
void dSetCanvasDefaultClearColor (const Color &color)
 
auto dCanvasFrameBuffer () const
 
bool dReadDepth (const Point2i &point, ReadBufferTypes::CallbackReadBuffer callback=nullptr)
 
void dScreenshot (const std::string &filename, uint width, uint height)
 

Private Attributes

KeyModifiers mKeyModifiers = {KeyModifier::NO_MODIFIER}
 

Detailed Description

template<template< typename > typename WindowManagerT, template< typename > typename CanvasT, template< typename > typename... Drawers>
class vcl::RenderApp< WindowManagerT, CanvasT, Drawers >

The RenderApp class is a template class that combines a canvas, a window manager, and a set of drawers, allowing them to work together and communicate with each other.

The RenderApp class uses the Curiously Recurring Template Pattern (CRTP) to allow the derived classes to access the member functions of the RenderApp class that propagate events from one derived class (e.g. the WindowManager) to another (e.g. the Canvas).

Each derived class has a role:

  • The WindowManager class manages the window and the window events.
  • The Canvas class manages the render backend and the surface where the drawers can draw.
  • The Drawer classes draws the content on the canvas.
Template Parameters
WindowManagerTThe type of the window manager class. It must satisfy the WindowManagerConcept.

Member Function Documentation

◆ callEventFunForDrawers()

template<template< typename > typename WindowManagerT, template< typename > typename CanvasT, template< typename > typename... Drawers>
template<typename D , typename... Others>
void vcl::RenderApp< WindowManagerT, CanvasT, Drawers >::callEventFunForDrawers ( auto  lambda)
inlineprivate

Calls a lambda function - that represents an event - for every Drawer object listed in the template parameter pack.

This function checks if the lambda function can be called for the D type, and if it can, it calls it. Then, it calls itself recursively for the other Drawer types in the list.

This function will call the lambda function for each Drawer object in the template parameter pack, in the order they are listed, only if several conditions are satisfied:

  • The D type must satisfy the EventDrawerConcept: if it does not, the lambda will not be called for that type.
  • If the D type satisfies the CanBlockEventDrawerConcept, the lambda function will return a boolean value that will be used to block the event propagation to the other drawers.
Parameters
lambda

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