Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Include Files in GLCore.h #4

Open
gmCAD opened this issue Jan 18, 2020 · 1 comment
Open

Missing Include Files in GLCore.h #4

gmCAD opened this issue Jan 18, 2020 · 1 comment

Comments

@gmCAD
Copy link

gmCAD commented Jan 18, 2020

Should the following libraries be added to the GLCore.h?

#include "GLCore/Core/Input.h"
#include "GLCore/Core/MouseButtonCodes.h"
#include "GLCore/Core/KeyCodes.h"

In the sandbox example, I was trying to get the mouse location to highlight the box when the mouse hovered over it. I had to add these included files to get the mouse location.

@SeppahBaws
Copy link

Looking at the OpenGL-Examples solution, you can also do it using events, which is included in GLCore.h

in OnEvent:

EventDispatcher dispatcher(event);
dispatcher.Dispatch<MouseMovedEvent>(
	[&](MouseMovedEvent& e)
	{
		// now you can use e.GetX() and e.GetY()
	});

If you just want to use Input.h to get the mouse position feel free to do so - it's your project - but to me it seems like Cherno intended for it to be used this way.

One thing I would like to add is that if the mouse is not moving the event dispatcher won't fire any MouseMovedEvents, so for an FPS controller (or something similar) I would recommend polling the mouse position each frame, but then you would have to add those three includes you mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants