예제 #1
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::step()
	{
		INIT_ASSERT(Input);

		int count;

		for (unsigned i = 0; i < NUM_OF_KEYS; ++i)
		{
			keyState[i] = keyPress[i] > keyRelease[i];

			if (glfwGetKey(Window::instance().window, i) == GLFW_PRESS) keyPress[i]   = glfwGetTime();
			else														keyRelease[i] = glfwGetTime();
		}

		for (unsigned i = 0; i < NUM_OF_MOUSE_BTNS; ++i)
		{
			mouseState[i] = mousePress[i] > mouseRelease[i];

			if (glfwGetMouseButton(Window::instance().window, i) == GLFW_PRESS) mousePress[i]   = glfwGetTime();
			else																mouseRelease[i] = glfwGetTime();
		}

		for (unsigned i = 0; i < activeJoysticks; ++i)
		{
			for (unsigned j = 0; j < NUM_OF_JOY_BTNS; ++j)
			{
				joyState[i][j] = joyPress[i][j] > joyRelease[i][j];

				if (glfwGetJoystickButtons(i, &count)[j] == GLFW_PRESS) joyPress[i][j] = glfwGetTime();
				else													joyRelease[i][j] = glfwGetTime();
			}
		}

		double x, y;
		glfwGetCursorPos(Window::instance().window, &x, &y);

		mouseX = x;
		mouseY = y;

		for (unsigned i = 0; i < activeJoysticks; ++i)
			for (unsigned j = 0; j < NUM_OF_JOY_AXES; ++j)
				joyAxes[i][j] = glfwGetJoystickAxes(i, &count)[j];

		return false;
	}
예제 #2
0
bool Input::step()
{
    INIT_ASSERT(Input);
    for (unsigned i = 0; i < 400; ++i)
    {
        keyState[i] =       keyPress[i]   >  keyRelease[i];

        if (sfw::getKey(i)) keyPress[i]   = sfw::getTime();
        else                keyRelease[i] = sfw::getTime();
    }
    
    for (unsigned i = 0; i < 10; ++i)
    {
        mouseState[i] =             mousePress[i]   > mouseRelease[i];
        if (sfw::getMouseButton(i)) mousePress[i]   =  sfw::getTime();
        else                        mouseRelease[i] =  sfw::getTime();
    }

    mouseX = sfw::getMouseX();
    mouseY = sfw::getMouseY();
    return false;
}
예제 #3
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	float Input::getMouseY() { INIT_ASSERT(Input); return mouseY; }
예제 #4
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::getJoyRelease(int joy, unsigned key) { INIT_ASSERT(Input); return !getJoy(joy, key) && joyState[joy][key]; }
예제 #5
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::getJoyPress(int joy, unsigned key) { INIT_ASSERT(Input); return getJoy(joy, key) && !joyState[joy][key]; }
예제 #6
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::getJoy(int joy, unsigned key) { INIT_ASSERT(Input); return joyPress[joy][key] > joyRelease[joy][key]; }
예제 #7
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	float Input::getJoyAxis(int joy, unsigned axis) { INIT_ASSERT(Input); return joyAxes[joy][axis]; }
예제 #8
0
void Window::term()
{
	INIT_ASSERT(Window);
	sfw::termContext();
}
예제 #9
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::getMouseButtonPress(unsigned key) { INIT_ASSERT(Input); return getMouseButton(key) && !mouseState[key]; }
예제 #10
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::getMouseButton(unsigned key) { INIT_ASSERT(Input); return mousePress[key] > mouseRelease[key]; }
예제 #11
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	float Input::keyDelta(unsigned key) { INIT_ASSERT(Input); return keyPress[key] - keyRelease[key]; }
예제 #12
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::getKeyRelease(unsigned key) { INIT_ASSERT(Input); return !getKey(key) && keyState[key]; }
예제 #13
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::getKeyPress(unsigned key) { INIT_ASSERT(Input); return getKey(key) && !keyState[key]; }
예제 #14
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::getKey(unsigned key) { INIT_ASSERT(Input); return keyPress[key] > keyRelease[key]; }
예제 #15
0
float Time::getTotalTime()
{
	INIT_ASSERT(Time);
	return sfw::getTime();
}
예제 #16
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	bool Input::getMouseButtonRelease(unsigned key) { INIT_ASSERT(Input); return !getMouseButton(key) && mouseState[key]; }
예제 #17
0
float Time::getDeltaTime()
{
	INIT_ASSERT(Time);
	return sfw::getDeltaTime();
}
예제 #18
0
파일: Input.cpp 프로젝트: Sethix/GameEngine
	int Input::getActiveJoysticks() { INIT_ASSERT(Input); return activeJoysticks; }
예제 #19
0
bool Window::step()
{
	INIT_ASSERT(Window);
	return sfw::stepContext();
}
예제 #20
0
void Window::term() {
    INIT_ASSERT(Window);
    sfw::termContext();
    isInit = false;
}