Leviathan  0.8.0.0
Leviathan game engine
Graphics.h
Go to the documentation of this file.
1 // Leviathan Game Engine
2 // Copyright (c) 2012-2019 Henri Hyyryläinen
3 #pragma once
4 #include "Define.h"
5 // ------------------------------------ //
7 
8 #include "bsfCore/RenderAPI/BsRenderWindow.h"
9 
10 namespace Leviathan {
11 
12 class Graphics {
13  friend Window;
14 
15  struct Private;
16 
17 public:
20 
21  DLLEXPORT bool Init(AppDef* appdef);
22  DLLEXPORT void Release();
23 
24  DLLEXPORT bool Frame();
25 
26  DLLEXPORT void UpdateShownOverlays(const std::vector<bs::SPtr<bs::Texture>>& overlays);
27 
28  DLLEXPORT bool IsVerticalUVFlipped() const;
29 
30  // ------------------------------------ //
31  // Resource loading helpers
32 
38  DLLEXPORT bs::HShader LoadShaderByName(const std::string& name);
39 
41  DLLEXPORT bs::HTexture LoadTextureByName(const std::string& name);
42 
44  DLLEXPORT bs::HMesh LoadMeshByName(const std::string& name);
45 
47  DLLEXPORT bs::HAnimationClip LoadAnimationClipByName(const std::string& name);
48 
49 #ifdef __linux
50  DLLEXPORT static bool HasX11ErrorOccured();
57 #endif
58 
59 protected:
62  bs::SPtr<bs::RenderWindow> RegisterCreatedWindow(Window& window);
63 
64 private:
65  bool InitializeBSF(AppDef* appdef);
66  void ShutdownBSF();
67 
68 private:
69  bool Initialized = false;
70  bool FirstWindowCreated = false;
71 
72  std::unique_ptr<Private> Pimpl;
73 };
74 } // namespace Leviathan
DLLEXPORT bool Init(AppDef *appdef)
Definition: Graphics.cpp:242
DLLEXPORT bs::HMesh LoadMeshByName(const std::string &name)
Works the same as LoadShaderByName.
Definition: Graphics.cpp:719
bs::SPtr< bs::RenderWindow > RegisterCreatedWindow(Window &window)
Called when Window objects are created to register them with bsf and with the case of the first windo...
Definition: Graphics.cpp:394
DLLEXPORT bool IsVerticalUVFlipped() const
Definition: Graphics.cpp:662
DLLEXPORT ~Graphics()
Definition: Graphics.cpp:237
DLLEXPORT bs::HTexture LoadTextureByName(const std::string &name)
Works the same as LoadShaderByName.
Definition: Graphics.cpp:696
DLLEXPORT bs::HAnimationClip LoadAnimationClipByName(const std::string &name)
Works the same as LoadShaderByName.
Definition: Graphics.cpp:742
DLLEXPORT bool Frame()
Definition: Graphics.cpp:538
DLLEXPORT Graphics()
Definition: Graphics.cpp:235
DLLEXPORT bs::HShader LoadShaderByName(const std::string &name)
Finds and loads a shader with the name.
Definition: Graphics.cpp:671
DLLEXPORT void UpdateShownOverlays(const std::vector< bs::SPtr< bs::Texture >> &overlays)
Definition: Graphics.cpp:643
#define DLLEXPORT
Definition: Include.h:84
DLLEXPORT void Release()
Definition: Graphics.cpp:319
The access mask controls which registered functions and classes a script sees.
Definition: GameModule.h:12