Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
MenuButton Class Reference

Represents a button in a menu. More...

#include <GameMenu.hpp>

Public Types

enum class  State : uint { OFF , HOVER , ON }
 Button state.
 

Public Member Functions

 MenuButton (const glm::vec2 &screenPos, const glm::vec2 &meshSize, float screenScale, int actionTag, const Texture *texture)
 
bool contains (const glm::vec2 &mousePos) const
 

Public Attributes

State state = State::OFF
 The button interaction state.
 
glm::vec2 pos = glm::vec2(0.0f)
 Screen position.
 
glm::vec2 size = glm::vec2(1.0f)
 Screen size.
 
glm::vec2 scale = glm::vec2(1.0f)
 Screen scale.
 
float displayScale = 1.0f
 Initial display scale.
 
int tag = 0
 Action ID.
 
const Texturetid = nullptr
 Text texture.
 

Detailed Description

Represents a button in a menu.

Inherited by MenuToggle.

Constructor & Destructor Documentation

◆ MenuButton()

MenuButton::MenuButton ( const glm::vec2 &  screenPos,
const glm::vec2 &  meshSize,
float  screenScale,
int  actionTag,
const Texture texture 
)

Creates a new momentaneous button.

Parameters
screenPosposition on screen in absolute units
meshSizethe size of the button mesh
screenScalescaling to apply to the toggle on the X axis
actionTagthe ID of the action associated to this button
texturethe text texture on the button

Member Function Documentation

◆ contains()

bool MenuButton::contains ( const glm::vec2 &  mousePos) const

Check if a position is inside the button.

Parameters
mousePosthe position to test (in absolute units)
Returns
a boolean denoting if the tested position falls inside the button on screen.

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