Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members

DigitalController.h

Go to the documentation of this file.
00001 /*********************************************************************************
00002  *
00003  * Razor! Engine - A modular C++ presentation engine
00004  *
00005  * $Id: DigitalController.h,v 1.3 2003/03/17 22:18:20 teacy Exp $
00006  *
00007  * Copyright (c) 2003 Tilo Christ. All Rights Reserved.
00008  *
00009  * Permission is hereby granted, free of charge, to any person obtaining a 
00010  * copy of this software and associated documentation files (the  "Software"), 
00011  * to deal in the Software without restriction, including without limitation 
00012  * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
00013  * and/or sell copies of the Software, and to permit persons to whom the Software 
00014  * is furnished to do so, subject to the following conditions:
00015  *
00016  * The above copyright notice and this permission notice shall be included in all 
00017  * copies or substantial portions of the Software.
00018  *
00019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
00020  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
00021  * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
00022  * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
00023  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00024  *
00025  **********************************************************************************/
00026 
00027 
00028 #ifndef DIGITAL_CONTROLLER_H
00029 #define DIGITAL_CONTROLLER_H
00030 
00031 #include "RazorSections.h"
00032 
00033 #include "input/Controller.h"
00034 
00035 
00036 /**
00037  * A digital controller can steer in 8 directions, 
00038  * and has a couple of buttons that can be pushed.
00039  */
00040 class DigitalController : public Controller
00041 {
00042     public:
00043     /**
00044      * Return the current direction of the controller
00045      *
00046      * @return an arbitrary bitwise OR-ed combination of the DIR_xxx constants
00047      */
00048     virtual int getDirection() const SEC_RAZOR = 0;
00049 
00050     /**
00051      * Return the number of supported buttons
00052      */
00053     virtual int getButtonCount() const SEC_RAZOR = 0;
00054 
00055     /**
00056      * Return whether a button is currently pressed
00057      */
00058     virtual bool isButtonPressed(int buttonIndex) const SEC_RAZOR = 0;
00059 
00060     static const int DIR_RELEASED = 0;
00061     static const int DIR_UP       = 1;
00062     static const int DIR_DOWN     = 2;
00063     static const int DIR_RIGHT    = 4;
00064     static const int DIR_LEFT     = 8;
00065 
00066     virtual ~DigitalController() = 0;
00067 
00068     protected:
00069     DigitalController() SEC_RAZOR;
00070 };
00071 
00072 
00073 #endif

Razor! Engine Developer's Guide. Copyright © by Tilo Christ. All Rights Reserved. Last updated: 31 May 2003