mirror of
https://github.com/encounter/cpp3ds.git
synced 2026-03-30 11:04:22 -07:00
Starting to phase-out Input.hpp in favor of SFML-named input headers
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
//#include <cpp3ds/Window/Context.hpp>
|
||||
//#include <cpp3ds/Window/ContextSettings.hpp>
|
||||
#include <cpp3ds/Window/Event.hpp>
|
||||
#include <cpp3ds/Window/EventManager.hpp>
|
||||
|
||||
#include <cpp3ds/Window/Input.hpp>
|
||||
//#include <cpp3ds/Window/Input.hpp>
|
||||
//#include <cpp3ds/Window/Joystick.hpp>
|
||||
//#include <cpp3ds/Window/Keyboard.hpp>
|
||||
#include <cpp3ds/Window/Keyboard.hpp>
|
||||
//#include <cpp3ds/Window/Mouse.hpp>
|
||||
//#include <cpp3ds/Window/Touch.hpp>
|
||||
//#include <cpp3ds/Window/Sensor.hpp>
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#ifdef SIMULATION
|
||||
#include <cpp3ds/Window/Input_sim.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef CPP3DS_INPUT_HPP
|
||||
#define CPP3DS_INPUT_HPP
|
||||
|
||||
#define HID 0x10146000
|
||||
|
||||
#define SLIDERSTATE 0x10144000
|
||||
|
||||
namespace cpp3ds {
|
||||
|
||||
enum Button {
|
||||
BUTTON_A = 1,
|
||||
BUTTON_B = 2,
|
||||
BUTTON_X = 1024,
|
||||
BUTTON_Y = 2048,
|
||||
BUTTON_UP = 64,
|
||||
BUTTON_DOWN = 128,
|
||||
BUTTON_LEFT = 32,
|
||||
BUTTON_RIGHT = 16,
|
||||
BUTTON_L1 = 512,
|
||||
BUTTON_R1 = 256,
|
||||
BUTTON_START = 8,
|
||||
BUTTON_SELECT = 4
|
||||
};
|
||||
|
||||
typedef void (*InputCallback)(Button button);
|
||||
|
||||
class Input {
|
||||
protected:
|
||||
int getHID();
|
||||
int last_hid;
|
||||
public:
|
||||
static float slider;
|
||||
static bool isDown(Button button);
|
||||
static void update(float deltaTime);
|
||||
static float get3DSlider(){ return Input::slider; }
|
||||
// int bind(Button button, Event event);
|
||||
// void unbind(int binding);
|
||||
// void unbindAll();
|
||||
// void unbindAll(Button button);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef CPP3DS_INPUT_HPP
|
||||
#define CPP3DS_INPUT_HPP
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
namespace cpp3ds {
|
||||
|
||||
typedef sf::Keyboard::Key Button;
|
||||
|
||||
// enum Button {
|
||||
// BUTTON_A = 1,
|
||||
// BUTTON_B = 2,
|
||||
// BUTTON_X = 1024,
|
||||
// BUTTON_Y = 2048,
|
||||
const Button BUTTON_UP = sf::Keyboard::Up;
|
||||
const Button BUTTON_DOWN = sf::Keyboard::Down;
|
||||
const Button BUTTON_LEFT = sf::Keyboard::Left;
|
||||
const Button BUTTON_RIGHT = sf::Keyboard::Right;
|
||||
// BUTTON_L1 = 512,
|
||||
// BUTTON_R1 = 256,
|
||||
// BUTTON_START = 8,
|
||||
// BUTTON_SELECT = 4
|
||||
// };
|
||||
|
||||
typedef void (*InputCallback)(Button button);
|
||||
|
||||
class Input {
|
||||
protected:
|
||||
int getHID();
|
||||
int last_hid;
|
||||
public:
|
||||
static float slider;
|
||||
static bool isDown(Button button);
|
||||
static void update(float deltaTime);
|
||||
static float get3DSlider(){ return Input::slider; }
|
||||
// int bind(Button button, Event event);
|
||||
// void unbind(int binding);
|
||||
// void unbindAll();
|
||||
// void unbindAll(Button button);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -4,7 +4,8 @@
|
||||
#include <inttypes.h>
|
||||
#include <cpp3ds/Window/BottomScreen.hpp>
|
||||
#include <cpp3ds/Window/TopScreen.hpp>
|
||||
#include <cpp3ds/Window/Input.hpp>
|
||||
//#include <cpp3ds/Window/Keyboard.hpp>
|
||||
#include <cpp3ds/Window/EventManager.hpp>
|
||||
|
||||
namespace cpp3ds {
|
||||
|
||||
@@ -15,9 +16,11 @@ namespace cpp3ds {
|
||||
protected:
|
||||
uint64_t lastTime;
|
||||
public:
|
||||
virtual ~Scene() {}
|
||||
BottomScreen bottomScreen;
|
||||
TopScreen topScreen;
|
||||
Input input;
|
||||
// Input input;
|
||||
EventManager events;
|
||||
void display();
|
||||
virtual int update(float deltaTime) = 0;
|
||||
virtual void render() = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <cpp3ds/Graphics/Stage.hpp>
|
||||
#include <cpp3ds/Graphics/Actor.hpp>
|
||||
#include <cpp3ds/Window/Input.hpp>
|
||||
#include <cpp3ds/Window/Keyboard.hpp>
|
||||
#include <cpp3ds/System/utils.hpp>
|
||||
|
||||
namespace cpp3ds {
|
||||
@@ -48,7 +48,7 @@ namespace cpp3ds {
|
||||
while (cur != nullptr) {
|
||||
Actor& actor = *cur->actor;
|
||||
if (use3D) {
|
||||
float slider = Input::get3DSlider() * actor.depth3d;
|
||||
float slider = Keyboard::get3DSlider() * actor.depth3d;
|
||||
actor.draw(screen, (isLeftside) ? x-slider : x+slider, y, use3D, isLeftside);
|
||||
} else {
|
||||
actor.draw(screen, x, y, use3D, isLeftside);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <cpp3ds/Window/Input.hpp>
|
||||
#include <cpp3ds/Window/Input_.hpp>
|
||||
#include <cpp3ds/System/utils.hpp>
|
||||
|
||||
namespace cpp3ds {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <cpp3ds/Window/Screen.hpp>
|
||||
#include <cpp3ds/Window/Scene.hpp>
|
||||
#include <cpp3ds/Window/Display.hpp>
|
||||
#include <cpp3ds/Window/Keyboard.hpp>
|
||||
#include <cpp3ds/System/utils.hpp>
|
||||
|
||||
namespace cpp3ds {
|
||||
@@ -16,7 +17,7 @@ namespace cpp3ds {
|
||||
display();
|
||||
deltaTime = (float)(GetSystemTick() - lastTime) / TICKS_PER_SEC;
|
||||
lastTime = GetSystemTick();
|
||||
Input::update(deltaTime);
|
||||
Keyboard::update();
|
||||
ret = update(deltaTime);
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <cpp3ds/Window/TopScreen.hpp>
|
||||
#include <cpp3ds/Window/Input.hpp>
|
||||
#include <cpp3ds/Window/Keyboard.hpp>
|
||||
#include <cpp3ds/Graphics/Color.hpp>
|
||||
#include <cpp3ds/Graphics/Drawable.hpp>
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace cpp3ds {
|
||||
|
||||
void TopScreen::draw(Drawable& obj, float x, float y, bool use3D) {
|
||||
if (use3D) {
|
||||
float slider = Input::get3DSlider() * obj.depth3d;
|
||||
float slider = Keyboard::get3DSlider() * obj.depth3d;
|
||||
obj.draw(left_screen, x - slider, y, use3D, true);
|
||||
obj.draw(right_screen, x + slider, y, use3D, false);
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <cpp3ds/Simulator/Simulator.hpp>
|
||||
#include <cpp3ds/System/utils.hpp>
|
||||
#include <cpp3ds/Window/Input.hpp>
|
||||
#include <cpp3ds/Window/Input_.hpp>
|
||||
|
||||
namespace cpp3ds {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace cpp3ds {
|
||||
if (useDisplay)
|
||||
display();
|
||||
deltaTime = clock.restart();
|
||||
Input::update(deltaTime.asSeconds());
|
||||
Keyboard::update();
|
||||
ret = update(deltaTime.asSeconds());
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <cpp3ds/Window/TopScreen.hpp>
|
||||
#include <cpp3ds/Window/Input.hpp>
|
||||
#include <cpp3ds/Window/Keyboard.hpp>
|
||||
#include <cpp3ds/Graphics/Color.hpp>
|
||||
#include <cpp3ds/Graphics/Drawable.hpp>
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace cpp3ds {
|
||||
|
||||
void TopScreen::draw(Drawable& obj, float x, float y, bool use3D) {
|
||||
if (use3D) {
|
||||
float slider = Input::get3DSlider() * obj.depth3d;
|
||||
float slider = Keyboard::get3DSlider() * obj.depth3d;
|
||||
obj.draw(left_screen, x - slider, y, use3D, true);
|
||||
obj.draw(right_screen, x + slider, y, use3D, false);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user