~ Fix background setup not working properly after the implementation of mouse support

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2021-12-04 23:44:17 +01:00
parent b55f2e8bf4
commit 18ab051d47
3 changed files with 15 additions and 8 deletions

View File

@ -179,6 +179,8 @@ int main (int argc, char* argv[])
// parse the project.json file
auto project = WallpaperEngine::Core::CProject::fromFile ("project.json", containers);
WallpaperEngine::Render::CWallpaper* wallpaper;
// initialize custom context class
WallpaperEngine::Render::CContext* context = new WallpaperEngine::Render::CContext (screens);
// auto projection = project->getWallpaper ()->as <WallpaperEngine::Core::CScene> ()->getOrthogonalProjection ();
// create the window!
@ -193,12 +195,12 @@ int main (int argc, char* argv[])
return 2;
}
glfwMakeContextCurrent (window);
// initialize inputs
CMouseInput* mouseInput = new CMouseInput (window);
// initialize custom context class
WallpaperEngine::Render::CContext* context = new WallpaperEngine::Render::CContext (screens, mouseInput);
context->setMouse (mouseInput);
glfwMakeContextCurrent (window);
// TODO: FIGURE THESE OUT BASED ON THE SCREEN
int windowWidth = 1920;

View File

@ -10,12 +10,11 @@
using namespace WallpaperEngine::Render;
CContext::CContext (std::vector <std::string> screens, CMouseInput* mouse) :
CContext::CContext (std::vector <std::string> screens) :
m_wallpaper (nullptr),
m_screens (std::move (screens)),
m_isRootWindow (m_screens.empty () == false),
m_defaultViewport ({0, 0, 1920, 1080}),
m_mouse (mouse)
m_defaultViewport ({0, 0, 1920, 1080})
{
this->initializeViewports ();
}
@ -117,4 +116,9 @@ void CContext::setDefaultViewport (glm::vec4 defaultViewport)
CMouseInput* CContext::getMouse () const
{
return this->m_mouse;
}
void CContext::setMouse (CMouseInput* mouse)
{
this->m_mouse = mouse;
}

View File

@ -15,13 +15,14 @@ namespace WallpaperEngine::Render
class CContext
{
public:
CContext (std::vector <std::string> screens, CMouseInput* mouse);
CContext (std::vector <std::string> screens);
void initializeViewports ();
void render ();
void setWallpaper (CWallpaper* wallpaper);
void setDefaultViewport (glm::vec4 defaultViewport);
CMouseInput* getMouse () const;
void setMouse (CMouseInput* mouse);
private:
std::vector <std::string> m_screens;
std::vector <glm::vec4> m_viewports;