diff --git a/test/Audio_test.cpp b/test/Audio_test.cpp index 1860eeb..a60a198 100644 --- a/test/Audio_test.cpp +++ b/test/Audio_test.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Audio_test.cpp,v 1.3 2005/07/18 05:14:19 cozman Exp $ +// $Id: Audio_test.cpp,v 1.4 2005/07/19 05:57:58 cozman Exp $ #include "photon.hpp" using namespace photon; @@ -198,9 +198,8 @@ public: int main(const StrVec& args) { AppCore::getInstance().createDisplay(800,600,32,0,0,false); - - AudioCore::setDesiredDevice("OSS"); - new AudioCore; + + AudioCore::initAudioDevice("OSS"); Kernel::getInstance().addTask(TaskPtr(new MainTask())); diff --git a/test/Input_test.cpp b/test/Input_test.cpp index dca6f6d..0545072 100644 --- a/test/Input_test.cpp +++ b/test/Input_test.cpp @@ -5,12 +5,47 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Input_test.cpp,v 1.1 2005/07/17 06:19:18 cozman Exp $ +// $Id: Input_test.cpp,v 1.2 2005/07/19 05:57:43 cozman Exp $ #include "photon.hpp" using namespace photon; #include +class LastEventListener : public InputListener +{ +public: + void onKeyPress(int key) + { + lastEvent = "key " + boost::lexical_cast(key) + + " pressed"; + } + + void onKeyRelease(int key) + { + lastEvent = "key " + boost::lexical_cast(key) + + " released"; + } + + void onMouseButtonPress(int button) + { + lastEvent = "mouse button " + boost::lexical_cast(button) + + " pressed"; + } + + void onMouseButtonRelease(int button) + { + lastEvent = "mouse button " + boost::lexical_cast(button) + + " released"; + } + + void onMouseMove(const math::Vector2& pos) + { + lastEvent = "mouse moved to " + boost::lexical_cast(pos); + } + + std::string lastEvent; +}; + class MainTask : public Task { @@ -45,11 +80,19 @@ public: video.clear(); + font.beginDraw(0,curHeight) << "Last event: " << lel.lastEvent << + font.endDraw(); + curHeight += fontHeight; + font.beginDraw(0,curHeight) << "Mouse at " << app.getMouseX() << "," << app.getMouseY() << " wheel = " << app.getMouseWheelPos() << font.endDraw(); curHeight += fontHeight; + font.beginDraw(0,curHeight) << "#Pressed Keys = " << + app.getPressedKeys().size() << font.endDraw(); + curHeight += fontHeight; + if(app.keyPressed(KEY_SPACE)) { font.drawText(0,curHeight, "Space key is pressed."); @@ -80,6 +123,7 @@ public: private: video::Font font; + LastEventListener lel; Log log; AppCore& app;