Vigilante Game Framework
1.0.0.8
A 2D/3D C++ Game Framework using SFML.
|
A singleton class that holds a lot of global properties other object require. More...
#include <VGlobal.h>
Public Member Functions | |
void | SetTitle (const char *newTitle) |
void | SetTitle (std::string newTitle) |
const char * | GetTitle () |
void | SetFullscreen (bool set) |
void | ToggleFullscreen () |
Toggles from fullscreen to window mode. | |
bool | IsFullscreen () |
bool | IsRunning () |
sf::Vector2f | GetMousePosition () |
void | SetMouseCursorVisible (bool set) |
VState * | CurrentState () |
void | ChangeState (VState *state) |
void | PushState (VState *state) |
void | PopState () |
Pop the current state from the stack. | |
void | ClearState () |
Clear all states from the stack. | |
void | Exit () |
Close window and close out game. | |
bool | OverlapAtPoint (const sf::Vector2f &point, VBase *a) |
bool | Overlaps (VBase *a, VBase *b=nullptr, std::function< void(VObject *, VObject *)>const &responseCall=nullptr, std::function< bool(VObject *, VObject *)>const &processCall=nullptr) |
bool | Collides (VBase *a, VBase *b=nullptr, std::function< void(VObject *, VObject *)>const &responseCall=nullptr) |
bool | OverlapCircleAtPoint (const sf::Vector2f &point, VBase *a) |
bool | OverlapsCircle (VBase *a, VBase *b=nullptr, std::function< void(VObject *, VObject *)>const &responseCall=nullptr, std::function< bool(VObject *, VObject *)>const &processCall=nullptr) |
bool | CollidesCircle (VBase *a, VBase *b=nullptr, std::function< void(VObject *, VObject *)>const &responseCall=nullptr) |
Static Public Member Functions | |
static VGlobal * | p () |
Access and creation of VGlobal. | |
static void | Cleanup () |
Cleans up all data in VGlobal to NULL. | |
Public Attributes | |
std::unique_ptr< sf::RenderWindow > | App |
Window the game is rendered on. | |
sf::RenderStates | RenderState |
sf::RenderStates object used for rendering the target to the scene with additional features like transform and blend mode. | |
sf::Vector2f | ViewportOffset |
Offset for the main game's viewport, important for the game window being resized and the screen needing to be repositioned in the window. | |
sf::ContextSettings | ContextSettings |
The OpenGL Context Settings. | |
bool | Antialiasing = false |
Should pixels be smooth or pixellated when the screen is resized? | |
bool | VSync = false |
Should the game use Verticle Syncing (where the framerate is based on the monitor refresh rate) instead of the variable framerate? | |
sf::Color | BackgroundColor = sf::Color::Black |
Colour of the Window's background prior to rendering. | |
float | TimeScale = 1.0f |
Speed of GameTime by manipulating the Delta Time. (e.g. 1 is default speed, 2 is 2x speed) | |
bool | FocusPause = true |
Set the game to pause when going out of focus. | |
unsigned int | Width = 0 |
VGame Area Width (Read Only) | |
unsigned int | Height = 0 |
VGame Area Height (Read Only) | |
unsigned int | WindowWidth = 0 |
Width of the game's Window. | |
unsigned int | WindowHeight = 0 |
Height of the game's Window. | |
sf::FloatRect | WorldBounds |
Bounderies of the game world regardless of state. Especially important for collision handling. | |
std::unique_ptr< VMusic > | Music |
Allows streamed audio files to be played between states (typically for music). | |
std::unique_ptr< VSoundManager > | Sound |
Allows loaded audio files to be played between states (typically for sound effects). | |
std::unique_ptr< VContent > | Content |
Content Management System for handling asset files (i.e. Textures, Fonts ect) | |
std::unique_ptr< VPostEffectBase > | PostProcess |
PostEffect used for the entire game, applied after the state is drawn. | |
float | FPS = 0 |
Frames Per Second - used to calculate average framerate. | |
bool | IfChangedState = false |
Value is true if the current VState is being changed in the state manager. | |
bool | IfPushedState = false |
Value is true if the a new VState is being pushed onto the stack in the state manager. | |
std::unique_ptr< VRandom > | Random |
Random Number Generator. | |
std::unique_ptr< VInputHandler > | Input |
Input Handling for Keyboard, Mouse and Controllers. | |
std::unique_ptr< VAsync > | Async |
Asynchronous Function Handler for Multithreaded Functionality. | |
int | WindowStyle |
Current Window Style being used (set with sf::Style). | |
A singleton class that holds a lot of global properties other object require.
bool VGlobal::Collides | ( | VBase * | a, |
VBase * | b = nullptr , |
||
std::function< void(VObject *, VObject *)>const & | responseCall = nullptr |
||
) |
Test if two objects are colliding by testing an overlap and applying the VObject::separate function as a process call to separate the objects.
a | The base object to test overlap with. |
b | The other base object to test overlap with. If you only want to test overlap with a itself (like in a VGroup), set this to null. |
responseCall | An optional response callback if an overlap is found. Only gets called if an overlap is true. |
bool VGlobal::CollidesCircle | ( | VBase * | a, |
VBase * | b = nullptr , |
||
std::function< void(VObject *, VObject *)>const & | responseCall = nullptr |
||
) |
Test if two objects are colliding by testing an overlap with circle overlap testing and applying the VObject::separateCircle function as a process call to separate the objects.
a | The base object to test overlap with. |
b | The other base object to test overlap with. If you only want to test overlap with a itself (like in a VGroup), set this to null. |
responseCall | An optional response callback if an overlap is found. Only gets called if an overlap is true. |
VState* VGlobal::CurrentState | ( | ) |
sf::Vector2f VGlobal::GetMousePosition | ( | ) |
const char* VGlobal::GetTitle | ( | ) |
bool VGlobal::IsFullscreen | ( | ) |
bool VGlobal::IsRunning | ( | ) |
bool VGlobal::OverlapAtPoint | ( | const sf::Vector2f & | point, |
VBase * | a | ||
) |
Test if an object is overlapping at a specified point.
point | The position in the game world to test with. |
a | The base object to test overlap with. |
bool VGlobal::OverlapCircleAtPoint | ( | const sf::Vector2f & | point, |
VBase * | a | ||
) |
Test if an object is overlapping at a specified point using circle overlap testing.
point | The position in the game world to test with. |
a | The base object to test overlap with. |
bool VGlobal::Overlaps | ( | VBase * | a, |
VBase * | b = nullptr , |
||
std::function< void(VObject *, VObject *)>const & | responseCall = nullptr , |
||
std::function< bool(VObject *, VObject *)>const & | processCall = nullptr |
||
) |
Test if two objects are overlapping.
a | The base object to test overlap with. |
b | The other base object to test overlap with. If you only want to test overlap with a itself (like in a VGroup), set this to null. |
responseCall | An optional response callback if an overlap is found. Only gets called if an overlap is true. |
processCall | An optional process callback if an overlap is found and there is a need to handle further tests and changes to the objects. Only gets called if an overlap is true, and should return true further collision tests are true. |
bool VGlobal::OverlapsCircle | ( | VBase * | a, |
VBase * | b = nullptr , |
||
std::function< void(VObject *, VObject *)>const & | responseCall = nullptr , |
||
std::function< bool(VObject *, VObject *)>const & | processCall = nullptr |
||
) |
Test if two objects are overlapping using circle overlap testing.
a | The base object to test overlap with. |
b | The other base object to test overlap with. If you only want to test overlap with a itself (like in a VGroup), set this to null. |
responseCall | An optional response callback if an overlap is found. Only gets called if an overlap is true. |
processCall | An optional process callback if an overlap is found and there is a need to handle further tests and changes to the objects. Only gets called if an overlap is true, and should return true further collision tests are true. |
void VGlobal::PushState | ( | VState * | state | ) |
state | A new VState to push onto the stack to run without changing the current one. |
void VGlobal::SetFullscreen | ( | bool | set | ) |
set | Set the game to fullscreen mode or not. |
void VGlobal::SetMouseCursorVisible | ( | bool | set | ) |
set | Sets mouse cursor to be visible or not, depending of if you want an in-game cursor. |
void VGlobal::SetTitle | ( | const char * | newTitle | ) |
newTitle | The new text the window should display in the title bar. |
void VGlobal::SetTitle | ( | std::string | newTitle | ) |
newTitle | The new text the window should display in the title bar. |