From cde21d2c0db9b019da42a5df4e16ef2e46cd9d57 Mon Sep 17 00:00:00 2001 From: Cruel Date: Mon, 17 Aug 2015 01:50:49 -0400 Subject: [PATCH] Delete some old input and screen code --- include/cpp3ds/Window/Input_.hpp | 48 ---------------------------- include/cpp3ds/Window/Input_sim_.hpp | 44 ------------------------- src/cpp3ds/Window/Input.cpp | 21 ------------ src/cpp3ds/Window/Screen.cpp | 47 --------------------------- src/emu3ds/Window/Display.cpp | 17 ---------- src/emu3ds/Window/Input.cpp | 24 -------------- src/emu3ds/Window/Screen.cpp | 45 -------------------------- 7 files changed, 246 deletions(-) delete mode 100644 include/cpp3ds/Window/Input_.hpp delete mode 100644 include/cpp3ds/Window/Input_sim_.hpp delete mode 100644 src/cpp3ds/Window/Input.cpp delete mode 100644 src/cpp3ds/Window/Screen.cpp delete mode 100644 src/emu3ds/Window/Display.cpp delete mode 100644 src/emu3ds/Window/Input.cpp delete mode 100644 src/emu3ds/Window/Screen.cpp diff --git a/include/cpp3ds/Window/Input_.hpp b/include/cpp3ds/Window/Input_.hpp deleted file mode 100644 index 90731f5..0000000 --- a/include/cpp3ds/Window/Input_.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifdef EMULATION -#include -#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 diff --git a/include/cpp3ds/Window/Input_sim_.hpp b/include/cpp3ds/Window/Input_sim_.hpp deleted file mode 100644 index d96d4ef..0000000 --- a/include/cpp3ds/Window/Input_sim_.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CPP3DS_INPUT_HPP -#define CPP3DS_INPUT_HPP - -#include - -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 diff --git a/src/cpp3ds/Window/Input.cpp b/src/cpp3ds/Window/Input.cpp deleted file mode 100644 index 2c8b2e4..0000000 --- a/src/cpp3ds/Window/Input.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -namespace cpp3ds { - - float Input::slider = 0; - - int Input::getHID(){ - last_hid = read_word(HID); - return last_hid; - } - - bool Input::isDown(Button button) { - return (~read_word(HID) & button); - } - - void Input::update(float deltaTime){ - Input::slider = (float)(read_word(SLIDERSTATE) & 0xFF) / 255; - } - -} diff --git a/src/cpp3ds/Window/Screen.cpp b/src/cpp3ds/Window/Screen.cpp deleted file mode 100644 index b50c22d..0000000 --- a/src/cpp3ds/Window/Screen.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include -#include -#include - -namespace cpp3ds { - - void Screen::setPixelAddress(int addr, Color color){ - write_byte(addr, color.b); - write_byte(addr+1, color.g); - write_byte(addr+2, color.r); - } - - void Screen::setPixel(int x, int y, Color color){ - int addr = (720*x+720-(y*3)-3) + frame1; - setPixelAddress(addr, color); - addr = (720*x+720-(y*3)-3) + frame2; - setPixelAddress(addr, color); - } - - void Screen::clear(Color color){ - if (color.r == color.g && color.g == color.b){ - memset((char*)frame1, color.r, width*height*3); - memset((char*)frame2, color.r, width*height*3); - } else { - // TODO: Too slow, maybe try memcpy? - char* frameptr1 = (char*)frame1; - char* frameptr2 = (char*)frame2; - for (int i = 0; i < width*height; ++i){ - *frameptr1++ = *frameptr2++ = color.b; - *frameptr1++ = *frameptr2++ = color.g; - *frameptr1++ = *frameptr2++ = color.r; - } - } - } - - void Screen::draw(Drawable& obj, float x, float y, bool use3D) { - // TODO: Check bounds and don't draw objects outside screen - obj.draw(*this, x, y, use3D, true); - } - - void Screen::_display(){ - buffer = !buffer; - } - -} diff --git a/src/emu3ds/Window/Display.cpp b/src/emu3ds/Window/Display.cpp deleted file mode 100644 index 4969dcb..0000000 --- a/src/emu3ds/Window/Display.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -namespace cpp3ds { - - void display(){ - _emulator->screen->display(); - if (_emulator->getState() == EMU_PAUSED){ - _emulator->screen->setActive(false); - _emulator->updatePausedFrame(); - while (_emulator->getState() == EMU_PAUSED) - sf::sleep(sf::milliseconds(100)); - } - // _simulator->screen->renderWindow.clear(); - } - -} diff --git a/src/emu3ds/Window/Input.cpp b/src/emu3ds/Window/Input.cpp deleted file mode 100644 index 9f4885a..0000000 --- a/src/emu3ds/Window/Input.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -namespace cpp3ds { - - float Input::slider = 0; - - int Input::getHID(){ - // last_hid = read_word(HID); - last_hid = 0; - return last_hid; - } - - bool Input::isDown(sf::Keyboard::Key button) { - // return (~read_word(HID) & button); - return sf::Keyboard::isKeyPressed(button); - } - - void Input::update(float deltaTime){ - Input::slider = _emulator->get_slider3d(); - } - -} diff --git a/src/emu3ds/Window/Screen.cpp b/src/emu3ds/Window/Screen.cpp deleted file mode 100644 index b932edc..0000000 --- a/src/emu3ds/Window/Screen.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include -#include -//#include -/* -namespace cpp3ds { - - void Screen::setPixel(int x, int y, Color color){ - sf::Color c(color.r, color.g, color.b); - pixelImage.setPixel(x, y, c); - } - - void Screen::clear(Color color){ - sf::RectangleShape box(sf::Vector2f(width, height)); - sf::Color c(color.r, color.g, color.b); - sf::Color outline(25,25,25); - box.setFillColor(c); - box.setOutlineColor(outline); - box.setOutlineThickness(EMU_OUTLINE_THICKNESS); - box.setPosition(x,y); - pixelImage.create(width, height, sf::Color::Transparent); - // Should only clear the relevant screen area - _emulator->screen->draw(box); - } - - void Screen::draw(cpp3ds::RenderTarget& target, cpp3ds::RenderStates states) { -// void Screen::draw(Drawable& obj, float x, float y, bool use3D) { - // TODO: Check bounds and don't draw objects outside screen -// obj.draw(*this, x, y, use3D, true); - Vertex* m_vertices = nullptr; - target.draw(m_vertices, states); - } - - void Screen::_display() { - sf::Texture starsTexture; - starsTexture.loadFromImage(pixelImage); - sf::Sprite test(starsTexture); - test.setPosition(x, y); - _emulator->screen->draw(test); - } - -} -*/