set version number and change return type of getPosition()
This commit is contained in:
parent
8b7d644958
commit
bbf58d0104
@ -1,6 +1,9 @@
|
||||
project(SparrowInput)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
SET(VERSION_MAJOR 1)
|
||||
SET(VERSION_MINOR 0)
|
||||
|
||||
# choose source file
|
||||
file(GLOB LIB_SRC_LIST src/input.cpp src/keybindings.cpp src/textbuffer.cpp)
|
||||
file(GLOB LIB_HEAD_LIST src/*.h)
|
||||
|
@ -162,14 +162,15 @@ void Input::releaseHeldKeys(sf::Keyboard::Key keycode){
|
||||
|
||||
/* mouse-related functions */
|
||||
|
||||
sf::Vector2i Input::getPosition() const
|
||||
glm::vec2 Input::getPosition() const
|
||||
{
|
||||
return m_mouse_position;
|
||||
return glm::vec2(m_mouse_position.x,m_mouse_position.y);
|
||||
}
|
||||
|
||||
sf::Vector2i Input::getDeltaPosition() const
|
||||
glm::vec2 Input::getDeltaPosition() const
|
||||
{
|
||||
return m_mouse_position - m_last_mouse_position;
|
||||
sf::Vector2i delta = m_mouse_position - m_last_mouse_position;
|
||||
return glm::vec2(delta.x,delta.y);
|
||||
}
|
||||
|
||||
float Input::getDeltaVerticalScroll() const
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include "textbuffer.h"
|
||||
#include "glm/vec2.hpp"
|
||||
|
||||
class Input{
|
||||
private:
|
||||
@ -62,8 +63,10 @@ public:
|
||||
bool isKeyPressed(int key) const;
|
||||
|
||||
/* mouse-related function */
|
||||
sf::Vector2i getPosition() const;
|
||||
sf::Vector2i getDeltaPosition() const;
|
||||
//sf::Vector2i getPosition() const;
|
||||
glm::vec2 getPosition() const;
|
||||
//sf::Vector2i getDeltaPosition() const;
|
||||
glm::vec2 getDeltaPosition() const;
|
||||
float getDeltaVerticalScroll() const;
|
||||
|
||||
/* Mouse grabbing */
|
||||
|
@ -55,12 +55,3 @@ int main()
|
||||
cerr << "Successfully ended" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*class MyInput : public Input
|
||||
{
|
||||
MyInput(sf::Window *w) : Input(w){
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user