diff --git a/src/archivers/lha/slide.cpp b/src/archivers/lha/slide.cpp index e779d505..9012d5f1 100644 --- a/src/archivers/lha/slide.cpp +++ b/src/archivers/lha/slide.cpp @@ -118,7 +118,7 @@ static unsigned int hval; static int matchlen; static unsigned int matchpos; static unsigned int pos; -//static unsigned int remainder; +static unsigned int remainder; #if 0 /* ------------------------------------------------------------------------ */ diff --git a/src/cfgfile.cpp b/src/cfgfile.cpp index e3056ccc..75b4ec12 100644 --- a/src/cfgfile.cpp +++ b/src/cfgfile.cpp @@ -31,6 +31,8 @@ #include "blkdev.h" #include "calc.h" +#include "SDL_keysym.h" + static int config_newfilesystem; static struct strlist *temp_lines; static struct zfile *default_file, *configstore; diff --git a/src/drawing.cpp b/src/drawing.cpp index 9be6df29..d2fff6da 100644 --- a/src/drawing.cpp +++ b/src/drawing.cpp @@ -71,7 +71,7 @@ bool ham_drawn = false; coordinates have a lower resolution (i.e. we're shrinking the image). */ static int res_shift; -extern SDL_Surface *screenSurface; +extern SDL_Surface *prSDLScreen; /* Lookup tables for dual playfields. The dblpf_*1 versions are for the case that playfield 1 has the priority, dbplpf_*2 are used if playfield 2 has diff --git a/src/guisan/libguisan.a b/src/guisan/libguisan.a deleted file mode 100644 index 766ed125..00000000 Binary files a/src/guisan/libguisan.a and /dev/null differ diff --git a/src/include/guisan.hpp b/src/include/guisan.hpp deleted file mode 100644 index b6492718..00000000 --- a/src/include/guisan.hpp +++ /dev/null @@ -1,124 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "guisan/platform.hpp" - -class Widget; - -extern "C" -{ - /** - * Gets the the version of Guisan. As it is a C function - * it can be used to check for Guichan with autotools. - * - * @return the version of Guisan. - */ - GCN_CORE_DECLSPEC extern const char* gcnGuisanVersion(); -} - -#endif // end GCN_GUISAN_HPP diff --git a/src/include/guisan/actionevent.hpp b/src/include/guisan/actionevent.hpp deleted file mode 100644 index 52a4319c..00000000 --- a/src/include/guisan/actionevent.hpp +++ /dev/null @@ -1,105 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -namespace gcn -{ - class Widget; - - /** - * Represents an action event. - * - * @author Olof Naessén - * @since 0.6.0 - */ - class GCN_CORE_DECLSPEC ActionEvent: public Event - { - public: - - /** - * Constructor. - * - * @param source the source widget of the event. - * @param id the identifier of the event. - */ - ActionEvent(Widget* source, const std::string& id); - - /** - * Destructor. - */ - virtual ~ActionEvent(); - - /** - * Gets the id of the event. - * - * @return the id of the event. - */ - const std::string& getId() const; - - protected: - std::string mId; - }; -} - -#endif // GCN_ACTIONEVENT_HPP - diff --git a/src/include/guisan/actionlistener.hpp b/src/include/guisan/actionlistener.hpp deleted file mode 100644 index eff7e9ed..00000000 --- a/src/include/guisan/actionlistener.hpp +++ /dev/null @@ -1,98 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/actionevent.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - /** - * Listener of action events from Widgets. To be able to - * listen for actions you must make a class which inherits - * from this class and implements the action function. - * - * @see Widget::addActionListener - * @author Olof Naessén - * @author Per Larsson - */ - class GCN_CORE_DECLSPEC ActionListener - { - public: - - /** - * Destructor. - */ - virtual ~ActionListener() { } - - /** - * Called when an action is recieved from a Widget. It is used - * to be able to recieve a notification that an action has - * occured. - * - * @param actionEvent the event of the action. - * @since 0.6.0 - */ - virtual void action(const ActionEvent& actionEvent) = 0; - - }; -} - -#endif // end GCN_ACTIONLISTENER_HPP diff --git a/src/include/guisan/basiccontainer.hpp b/src/include/guisan/basiccontainer.hpp deleted file mode 100644 index 6c12c6ba..00000000 --- a/src/include/guisan/basiccontainer.hpp +++ /dev/null @@ -1,159 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/deathlistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" - -namespace gcn -{ - /** - * Implements basic container behaviour. Most container will suffice by - * inheriting from this class. - * - * @see Container - */ - class GCN_CORE_DECLSPEC BasicContainer : public Widget, public DeathListener - { - public: - /** - * Destructor - */ - virtual ~BasicContainer(); - - - // Inherited from Widget - - virtual void moveToTop(Widget* widget); - - virtual void moveToBottom(Widget* widget); - - virtual Rectangle getChildrenArea(); - - virtual void focusNext(); - - virtual void focusPrevious(); - - virtual void logic(); - - virtual void _setFocusHandler(FocusHandler* focusHandler); - - void setInternalFocusHandler(FocusHandler* focusHandler); - - virtual void showWidgetPart(Widget* widget, Rectangle area); - - virtual Widget *getWidgetAt(int x, int y); - - - // Inherited from DeathListener - - virtual void death(const Event& event); - - protected: - /** - * Adds a widget to the basic container. - * - * @param widget the widget to add. - */ - void add(Widget* widget); - - /** - * Removes a widget from the basic container. - * - * @param widget the widget to remove. - */ - virtual void remove(Widget* widget); - - /** - * Clears the basic container from all widgets. - */ - virtual void clear(); - - /** - * Draws children widgets. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawChildren(Graphics* graphics); - - /** - * Calls logic for children widgets. - */ - virtual void logicChildren(); - - /** - * Finds a widget given an id. - * - * @param id the id to find a widget by. - * @return the widget with the corrosponding id, - NULL of no widget is found. - */ - virtual Widget* findWidgetById(const std::string& id); - - typedef std::list WidgetList; - typedef WidgetList::iterator WidgetListIterator; - typedef WidgetList::reverse_iterator WidgetListReverseIterator; - - WidgetList mWidgets; - }; -} - -#endif // end GCN_BASICCONTAINER_HPP diff --git a/src/include/guisan/cliprectangle.hpp b/src/include/guisan/cliprectangle.hpp deleted file mode 100644 index dc1190a5..00000000 --- a/src/include/guisan/cliprectangle.hpp +++ /dev/null @@ -1,111 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/event.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - /** - * Listener of death events from Widgets. To be able to - * listen for deaths you must make a class which inherits - * from this class and implements the death function. - * - * @see Widget::addDeathListener - * @author Olof Naessén - * @since 0.6.0 - */ - class GCN_CORE_DECLSPEC DeathListener - { - public: - - /** - * Destructor. - */ - virtual ~DeathListener() { } - - /** - * Called when a widget dies. It is used to be able to recieve - * a notification when a death of a widget occurs. - * - * @param event the event of the death. - */ - virtual void death(const Event& event) = 0; - - }; -} - -#endif // end GCN_DEATHLISTENER_HPP diff --git a/src/include/guisan/defaultfont.hpp b/src/include/guisan/defaultfont.hpp deleted file mode 100644 index 544ae0f8..00000000 --- a/src/include/guisan/defaultfont.hpp +++ /dev/null @@ -1,107 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/platform.hpp" - - -#ifdef _MSC_VER -#if _MSC_VER <= 1200 -#define __FUNCTION__ "?" -#endif -#endif - -/* - * A macro to be used when throwing exceptions. - * What it basicly does is that it creates a new exception - * and automatically sets the filename and line number where - * the exception occured. - */ -#define GCN_EXCEPTION(mess) gcn::Exception(mess, \ - __FUNCTION__, \ - __FILE__, \ - __LINE__) - -namespace gcn -{ - - /** - * An exception containing a message, a file and a line number. - * Guichan will only throw exceptions of this class. You can use - * this class for your own exceptions. A nifty feature of the - * excpetion class is that it can tell you from which line and - * file it was thrown. To make things easier when throwing - * exceptions there exists a macro for creating exceptions - * which automatically sets the filename and line number. - * - * EXAMPLE: @code - * throw GCN_EXCEPTION("my error message"); - * @endcode - */ - class GCN_CORE_DECLSPEC Exception - { - public: - - /** - * Constructor. - */ - Exception(); - - /** - * Constructor. - * - * @param message the error message. - */ - Exception(const std::string& message); - - /** - * Constructor. - * - * NOTE: Don't use this constructor. Use the GCN_EXCEPTION macro instead. - * - * @param message the error message. - * @param function the function name. - * @param filename the name of the file. - * @param line the line number. - */ - Exception(const std::string& message, - const std::string& function, - const std::string& filename, - int line); - - /** - * Gets the function name in which the exception was thrown. - * - * @return the function name in which the exception was thrown. - */ - const std::string& getFunction() const; - - /** - * Gets the error message of the exception. - * - * @return the error message. - */ - const std::string& getMessage() const; - - /** - * Gets the filename in which the exceptions was thrown. - * - * @return the filename in which the exception was thrown. - */ - const std::string& getFilename() const; - - /** - * Gets the line number of the line where the exception was thrown. - * - * @return the line number of the line where the exception was thrown. - */ - int getLine() const; - - protected: - std::string mFunction; - std::string mMessage; - std::string mFilename; - int mLine; - }; -} - -#endif // end GCN_EXCEPTION_HPP - -/* - * "Final Fantasy XI is the BEST!... It's even better then water!" - * - Astrolite - * I believe it's WoW now days. - */ diff --git a/src/include/guisan/focushandler.hpp b/src/include/guisan/focushandler.hpp deleted file mode 100644 index f9fdd90b..00000000 --- a/src/include/guisan/focushandler.hpp +++ /dev/null @@ -1,322 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/event.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - class Widget; - - /** - * Used to keep track of widget focus. You will probably not have - * to use the FocusHandler directly to handle focus. Widget has - * functions for handling focus which uses a FocusHandler. Use them - * instead. - * - * @see Widget::isFocused - * @see Widget::requestFocus - * @see Widget::setFocusable - * @see Widget::isFocusable - * @see FocusListener - */ - class GCN_CORE_DECLSPEC FocusHandler - { - public: - - /** - * Constructor. - */ - FocusHandler(); - - /** - * Destructor. - */ - virtual ~FocusHandler() { }; - - /** - * Sets focus to a widget. A focus event will also be sent to the widget's - * focus listeners. - * - * @param widget the widget to focus. - */ - virtual void requestFocus(Widget* widget); - - /** - * Sets modal focus to a widget. - * - * @param widget the Widget to focus modal. - * @throws Exception when another widget already has modal focus. - */ - virtual void requestModalFocus(Widget* widget); - - /** - * Releases modal focus if the widget has modal focus. - * Otherwise nothing will be done. - * - * @param widget the Widget to release modal focus for. - */ - virtual void releaseModalFocus(Widget* widget); - - /** - * Sets modal mouse input focus to a widget. Modal mouse input focus means - * no other widget then the widget with modal mouse input focus will - * receive mouse input.. - * The widget with modal mouse input focus will also receive mouse input no - * matter what the mouse input is or where the mouse input occurs. - * - * @param widget the widget to focus for modal mouse input focus. - * @throws Exception when another widget already has modal mouse input focus. - */ - virtual void requestModalMouseInputFocus(Widget* widget); - - /** - * Releases modal mouse input focus if the widget has modal mouse input - * focus. Otherwise nothing will be done. - * - * @param widget the widget to release modal mouse input focus for. - */ - virtual void releaseModalMouseInputFocus(Widget* widget); - - /** - * Gets the widget with focus. - * - * @return the Widget with focus. NULL will be returned if - * no Widget has focus. - */ - virtual Widget* getFocused() const; - - /** - * Gets the widget with modal focus. - * - * @return the Widget with modal focus. NULL will be returned - * if no Widget has modal focus. - */ - virtual Widget* getModalFocused() const; - - /** - * Gets the widget with modal mouse input focus. - * - * @return the widget with modal mouse input focus. NULL will be returned - * if no widget has modal mouse input focus. - */ - virtual Widget* getModalMouseInputFocused() const; - - /** - * Focuses the next Widget. If no Widget has focus the first - * Widget gets focus. The order in which the Widgets are focused - * depends on the order you add them to the GUI. - */ - virtual void focusNext(); - - /** - * Focuses the previous Widget. If no Widget has focus the first - * Widget gets focus. The order in which the widgets are focused - * depends on the order you add them to the GUI. - */ - virtual void focusPrevious(); - - /** - * Checks if a Widget is focused. - * - * @param widget widget to check if it is focused. - * @return true if the widget is focused. - */ - virtual bool isFocused(const Widget* widget) const; - - /** - * Adds a widget to the FocusHandler. - * - * @param widget the widget to add. - */ - virtual void add(Widget* widget); - - /** - * Removes a widget from the FocusHandler. - * - * @param widget the widget to remove. - */ - virtual void remove(Widget* widget); - - /** - * Focuses nothing. A focus event will also be sent to the focused widget's - * focus listeners if a widget has focus. - */ - virtual void focusNone(); - - /** - * Focuses the next Widget which allows tab in unless current focused - * Widget disallows tab out. - */ - virtual void tabNext(); - - /** - * Focuses the previous Widget which allows tab in unless current focused - * Widget disallows tab out. - */ - virtual void tabPrevious(); - - /** - * Gets the widget being dragged. - * - * @return the widget being dragged. - */ - virtual Widget* getDraggedWidget(); - - /** - * Sets the widget being dragged. - * - * @param draggedWidget the widget being dragged. - */ - virtual void setDraggedWidget(Widget* draggedWidget); - - /** - * Gets the last widget with the mouse. - * - * @return the last widget with the mouse. - */ - virtual Widget* getLastWidgetWithMouse(); - - /** - * Sets the last widget with the mouse. - * - * @param lastWidgetWithMouse the last widget with the mouse. - */ - virtual void setLastWidgetWithMouse(Widget* lastWidgetWithMouse); - - /** - * Gets the last widget with modal focus. - * - * @return the last widget with modal focus. - */ - virtual Widget* getLastWidgetWithModalFocus(); - - /** - * Sets the last widget with modal focus. - * - * @param lastWidgetWithModalFocus the last widget with modal focus. - */ - virtual void setLastWidgetWithModalFocus(Widget* lastWidgetWithModalFocus); - - /** - * Gets the last widget with modal mouse input focus. - * - * @return the last widget with modal mouse input focus. - */ - virtual Widget* getLastWidgetWithModalMouseInputFocus(); - - /** - * Sets the last widget with modal mouse input focus. - * - * @param lastMouseWithModalMouseInputFocus the last widget with modal mouse input focus. - */ - virtual void setLastWidgetWithModalMouseInputFocus(Widget* lastWidgetWithModalMouseInputFocus); - - /** - * Gets the last widget pressed. - * - * @return the last widget pressed. - */ - virtual Widget* getLastWidgetPressed(); - - /** - * Sets the last widget pressed. - * - * @param lastWidgetPressed the last widget pressed. - */ - virtual void setLastWidgetPressed(Widget* lastWidgetPressed); - - protected: - /** - * Distributes a focus lost event. - * - * @param focusEvent the event to distribute. - * @author Olof Naessén - * @since 0.7.0 - */ - virtual void distributeFocusLostEvent(const Event& focusEvent); - - /** - * Distributes a focus gained event. - * - * @param focusEvent the event to distribute. - * @author Olof Naessén - * @since 0.7.0 - */ - virtual void distributeFocusGainedEvent(const Event& focusEvent); - - typedef std::vector WidgetVector; - typedef WidgetVector::iterator WidgetIterator; - WidgetVector mWidgets; - - Widget* mFocusedWidget; - Widget* mModalFocusedWidget; - Widget* mModalMouseInputFocusedWidget; - - Widget* mDraggedWidget; - Widget* mLastWidgetWithMouse; - Widget* mLastWidgetWithModalFocus; - Widget* mLastWidgetWithModalMouseInputFocus; - Widget* mLastWidgetPressed; - }; -} - -#endif // end GCN_FOCUSHANDLER_HPP diff --git a/src/include/guisan/focuslistener.hpp b/src/include/guisan/focuslistener.hpp deleted file mode 100644 index e57a8e87..00000000 --- a/src/include/guisan/focuslistener.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/event.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - /** - * Listener of focus events from Widgets. To be able to listen for - * focus events you must make a class which inherits from this class - * and implements it's functions. - * - * @see Widget::addFocusListener - * @author Olof Naessén - * @since 0.7.0 - */ - class GCN_CORE_DECLSPEC FocusListener - { - public: - - /** - * Destructor. - */ - virtual ~FocusListener() { } - - /** - * Called when a widget gains focus. - * - * @param event discribes the event. - */ - virtual void focusGained(const Event& event) { }; - - /** - * Called when a widget loses focus. - * - * @param event discribes the event. - */ - virtual void focusLost(const Event& event) { }; - }; -} - -#endif // end GCN_FOCUSLISTENER_HPP diff --git a/src/include/guisan/font.hpp b/src/include/guisan/font.hpp deleted file mode 100644 index 7ea02cd2..00000000 --- a/src/include/guisan/font.hpp +++ /dev/null @@ -1,125 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include "guisan/platform.hpp" - -namespace gcn -{ - class Graphics; - - /** - * Holder of a font. Fonts should inherit from this class and - * implements it's functions. - * - * @see ImageFont - */ - class GCN_CORE_DECLSPEC Font - { - public: - - /** - * Destructor. - */ - virtual ~Font(){ } - - /** - * Gets the width of a string. The width of a string is not necesserily - * the sum of all the widths of it's glyphs. - * - * @param text the string to return the width of. - * @return the width of a string. - */ - virtual int getWidth(const std::string& text) const = 0; - - /** - * Gets the height of the glyphs in the font. - * - * @return the height of the glyphs int the font. - */ - virtual int getHeight() const = 0; - - /** - * Gets a string index in a string providing an x coordinate. - * Used to retrive a string index (for a character in a - * string) at a certain x position. It is especially useful - * when a mouse clicks in a TextField and you want to know which - * character was clicked. - * - * @return a string index in a string providing an x coordinate. - */ - virtual int getStringIndexAt(const std::string& text, int x); - - /** - * Draws a string. - * - * NOTE: You normally won't use this function to draw text since - * Graphics contains better functions for drawing text. - * - * @param graphics a Graphics object to use for drawing. - * @param text the string to draw. - * @param x the x coordinate where to draw the string. - * @param y the y coordinate where to draw the string. - */ - virtual void drawString(Graphics* graphics, const std::string& text, - int x, int y) = 0; - }; -} - -#endif // end GCN_FONT_HPP diff --git a/src/include/guisan/genericinput.hpp b/src/include/guisan/genericinput.hpp deleted file mode 100644 index 54e28d1a..00000000 --- a/src/include/guisan/genericinput.hpp +++ /dev/null @@ -1,168 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/input.hpp" -#include "guisan/keyinput.hpp" -#include "guisan/mouseinput.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - class Key; - - /** - * Generic input which can be used with any backend. - */ - class GCN_CORE_DECLSPEC GenericInput: public Input - { - public: - - /** - * Constructor. - */ - GenericInput(); - - /** - * Pushes a key pressed event. - * - * NOTE: If a special key is pressed, like the F1 key, - * the corresponding Guichan key value found - * in the enum in Key should be pushed as the - * unicode value. - * - * @param unicode the unicode value of the key. - */ - void pushKeyPressed(int unicode); - - /** - * Pushes a key released event. - * - * NOTE: If a special key is pressed, like the F1 key, - * the corresponding Guichan key value found - * in the enum in Key should be pushed as the - * unicode value. - * - * @param unicode the unicode value of the key. - */ - void pushKeyReleased(int unicode); - - /** - * Pushes a mouse button pressed event. - * - * @param x the x coordinate of the mouse event. - * @param y the y coordinate of the mouse event. - * @param button the button of the mouse event. - */ - void pushMouseButtonPressed(int x, int y, int button); - - /** - * Pushes a mouse button released event. - * - * @param x the x coordinate of the mouse event. - * @param y the y coordinate of the mouse event. - * @param button the button of the mouse event. - */ - void pushMouseButtonReleased(int x, int y, int button); - - /** - * Pushes a mouse wheel moved up event. - * - * @param x the x coordinate of the mouse event. - * @param y the y coordinate of the mouse event. - */ - void pushMouseWheelMovedUp(int x, int y); - - /** - * Pushes a mouse wheel moved down event. - * - * @param x the x coordinate of the mouse event. - * @param y the y coordinate of the mouse event. - */ - void pushMouseWheelMovedDown(int x, int y); - - /** - * Pushes a mouse moved event. - * - * @param x the x coordinate of the mouse event. - * @param y the y coordinate of the mouse event. - */ - void pushMouseMoved(int x, int y); - - - // Inherited from Input - - virtual bool isKeyQueueEmpty(); - - virtual KeyInput dequeueKeyInput(); - - virtual bool isMouseQueueEmpty(); - - virtual MouseInput dequeueMouseInput(); - - virtual void _pollInput(); - - protected: - std::queue mKeyInputQueue; - std::queue mMouseInputQueue; - }; -} - -#endif // end GCN_INPUT_HPP diff --git a/src/include/guisan/glut.hpp b/src/include/guisan/glut.hpp deleted file mode 100644 index 59c5647d..00000000 --- a/src/include/guisan/glut.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "platform.hpp" - -extern "C" -{ - /** - * Exists to be able to check for Guichan GLUT with autotools. - */ - GCN_EXTENSION_DECLSPEC extern void gcnGLUT(); -} - -#endif // end GCN_GLUT_HPP diff --git a/src/include/guisan/graphics.hpp b/src/include/guisan/graphics.hpp deleted file mode 100644 index b673dbd8..00000000 --- a/src/include/guisan/graphics.hpp +++ /dev/null @@ -1,280 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include - -#include "guisan/cliprectangle.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - class Color; - class Font; - class Image; - - /** - * Used for drawing graphics. It contains all vital functions for drawing. - * We include implemented Graphics classes for some common platforms like - * the Allegro library, the OpenGL library and the SDL library. To make - * Guichan usable under another platform, a Graphics class must be - * implemented. - * - * In Graphics you can set clip areas to limit drawing to certain - * areas of the screen. Clip areas are put on a stack, which means that you - * can push smaller and smaller clip areas onto the stack. All coordinates - * will be relative to the topmost clip area. In most cases you won't have - * to worry about the clip areas, unless you want to implement some really - * complex widget. Pushing and poping of clip areas are handled - * automatically by container widgets when their child widgets are drawn. - * - * IMPORTANT: Remember to pop each clip area that you pushed on the stack - * after you are done with it. - * - * If you feel that Graphics is to restrictive for your needs, there is - * no one stopping you from using your own code for drawing in Widgets. - * You could for instance use pure SDL in the drawing of Widgets bypassing - * Graphics. This might however hurt portability of your application. - * - * If you implement a Graphics class not present in Guichan we would be very - * happy to add it to Guichan. - * - * @see AllegroGraphics, OpenGLGraphics, SDLGraphics, Image - */ - class GCN_CORE_DECLSPEC Graphics - { - public: - Graphics(); - - virtual ~Graphics() { } - - /** - * Initializes drawing. Called by the Gui when Gui::draw() is called. - * It is needed by some implementations of Graphics to perform - * preparations before drawing. An example of such an implementation - * would be OpenGLGraphics. - * - * NOTE: You will never need to call this function yourself. - * Gui will do it for you. - * - * @see _endDraw, Gui::draw - */ - virtual void _beginDraw() { } - - /** - * Deinitializes drawing. Called by the Gui when a Gui::draw() is done. - * done. It should reset any state changes made by _beginDraw(). - * - * NOTE: You will never need to call this function yourself. - * Gui will do it for you. - * - * @see _beginDraw, Gui::draw - */ - virtual void _endDraw() { } - - /** - * Pushes a clip area onto the stack. The x and y coordinates in the - * Rectangle will be relative to the last pushed clip area. - * If the new area falls outside the current clip area, it will be - * clipped as necessary. - * - * @param area the clip area to be pushed onto the stack. - * @return false if the the new area lays totally outside the - * current clip area. Note that an empty clip area - * will be pused in this case. - */ - virtual bool pushClipArea(Rectangle area); - - /** - * Removes the topmost clip area from the stack. - * - * @throws Exception if the stack is empty. - */ - virtual void popClipArea(); - - /** - * Gets the current clip area. Usefull if you want to do drawing - * bypassing Graphics. - * - * @return the current clip area. - */ - virtual const ClipRectangle& getCurrentClipArea(); - - /** - * Draws a part of an Image. - * - * NOTE: Width and height arguments will not scale the Image but - * specifies the size of the part to be drawn. If you want - * to draw the whole Image there is a simplified version of - * this function. - * - * EXAMPLE: @code drawImage(myImage, 10, 10, 20, 20, 40, 40); @endcode - * Will draw a rectangular piece of myImage starting at - * coordinate (10, 10) in myImage, with width and height 40. - * The piece will be drawn with it's top left corner at - * coordinate (20, 20). - * - * @param image the Image to draw. - * @param srcX source Image x coordinate. - * @param srcY source Image y coordinate. - * @param dstX destination x coordinate. - * @param dstY destination y coordinate. - * @param width the width of the piece. - * @param height the height of the piece. - */ - virtual void drawImage(const Image* image, int srcX, int srcY, - int dstX, int dstY, int width, - int height) = 0; - /** - * Draws an image. A simplified version of the other drawImage. - * It will draw a whole image at the coordinate you specify. - * It is equivalent to calling: - * @code drawImage(myImage, 0, 0, dstX, dstY, image->getWidth(), \ - image->getHeight()); @endcode - */ - virtual void drawImage(const Image* image, int dstX, int dstY); - - /** - * Draws a single point/pixel. - * - * @param x the x coordinate. - * @param y the y coordinate. - */ - virtual void drawPoint(int x, int y) = 0; - - /** - * Ddraws a line. - * - * @param x1 the first x coordinate. - * @param y1 the first y coordinate. - * @param x2 the second x coordinate. - * @param y2 the second y coordinate. - */ - virtual void drawLine(int x1, int y1, int x2, int y2) = 0; - - /** - * Draws a simple, non-filled, Rectangle with one pixel width. - * - * @param rectangle the Rectangle to draw. - */ - virtual void drawRectangle(const Rectangle& rectangle) = 0; - - /** - * Draws a filled Rectangle. - * - * @param rectangle the filled Rectangle to draw. - */ - virtual void fillRectangle(const Rectangle& rectangle) = 0; - - /** - * Sets the Color to use when drawing. - * - * @param color a Color. - */ - virtual void setColor(const Color& color) = 0; - - /** - * Gets the Color to use when drawing. - * - * @return the Color used when drawing. - */ - virtual const Color& getColor() = 0; - - /** - * Sets the font to use when drawing text. - * - * @param font the Font to use when drawing. - */ - virtual void setFont(Font* font); - - /** - * Draws text. - * - * @param text the text to draw. - * @param x the x coordinate where to draw the text. - * @param y the y coordinate where to draw the text. - * @param alignment Graphics::LEFT, Graphics::CENTER or Graphics::RIGHT. - * @throws Exception when no Font is set. - */ - virtual void drawText(const std::string& text, int x, int y, - unsigned int alignment = LEFT); - /** - * Alignments for text drawing. - */ - enum - { - LEFT = 0, - CENTER, - RIGHT - }; - - protected: - std::stack mClipStack; - Font* mFont; - }; -} - -#endif // end GCN_GRAPHICS_HPP - -/* - * yakslem - "little cake on cake, but that's the fall" - * finalman - "skall jag skriva det?" - * yakslem - "ja, varfor inte?" - */ - diff --git a/src/include/guisan/gui.hpp b/src/include/guisan/gui.hpp deleted file mode 100644 index 5323173e..00000000 --- a/src/include/guisan/gui.hpp +++ /dev/null @@ -1,402 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include - -#include "guisan/keyevent.hpp" -#include "guisan/mouseevent.hpp" -#include "guisan/mouseinput.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - class FocusHandler; - class Graphics; - class Input; - class KeyListener; - class Widget; - - // The following comment will appear in the doxygen main page. - /** - * @mainpage - * @section Introduction - * This documentation is mostly intended as a reference to the API. If you want to get started with Guichan, we suggest you check out the programs in the examples directory of the Guichan release. - * @n - * @n - * This documentation is, and will always be, work in progress. If you find any errors, typos or inconsistencies, or if you feel something needs to be explained in more detail - don't hesitate to tell us. - */ - - /** - * Gui core class. Contains a special widget called the top widget. - * If you want to be able to have more then one Widget in your Gui, - * the top widget should be a Container. - * - * NOTE: For the Gui to function properly you need to set a Graphics - * object to use and an Input object to use. - */ - class GCN_CORE_DECLSPEC Gui - { - public: - - /** - * Constructor. - */ - Gui(); - - /** - * Destructor. - */ - virtual ~Gui(); - - /** - * Sets the top Widget. - * - * @param top the top Widget. - */ - virtual void setTop(Widget* top); - - /** - * Gets the top Widget. - * - * @return the top widget. NULL if no top widget has been set. - */ - virtual Widget* getTop() const; - - /** - * Sets the Graphics object to use for drawing. - * - * @param graphics the Graphics object to use for drawing. - * @see SDLGraphics, OpenGLGraphics, AllegroGraphics - */ - virtual void setGraphics(Graphics* graphics); - - /** - * Gets the Graphics object used for drawing. - * - * @return the Graphics object used for drawing. NULL if no - * Graphics object has been set. - */ - virtual Graphics* getGraphics() const; - - /** - * Sets the Input object to use for input handling. - * - * @param input the Input object to use for input handling. - * @see SDLInput, AllegroInput - */ - virtual void setInput(Input* input); - - /** - * Gets the Input object being used for input handling. - * - * @return the Input object used for handling input. NULL if no - * Input object has been set. - */ - virtual Input* getInput() const; - - /** - * Performs the Gui logic. By calling this function all logic - * functions down in the Gui heirarchy will be called. - * What performs in Logic can be just about anything like - * adjusting a Widgets size or doing some calculations. - * - * NOTE: Logic also deals with user input (Mouse and Keyboard) - * for Widgets. - */ - virtual void logic(); - - /** - * Draws the Gui. By calling this funcion all draw functions - * down in the Gui hierarchy will be called. - */ - virtual void draw(); - - /** - * Focus none of the Widgets in the Gui. - */ - virtual void focusNone(); - - /** - * Toggles the use of the tab key to focus Widgets. - * By default, tabbing is enabled. - * - * @param tabbing set to false if you want to disable tabbing. - */ - virtual void setTabbingEnabled(bool tabbing); - - /** - * Checks if tabbing is enabled. - * - * @return true if tabbing is enabled. - */ - virtual bool isTabbingEnabled(); - - /** - * Adds a global KeyListener to the Gui. - * - * @param keyListener a KeyListener to add. - */ - virtual void addGlobalKeyListener(KeyListener* keyListener); - - /** - * Remove global KeyListener from the Gui. - * - * @param keyListener a KeyListener to remove. - * @throws Exception if the KeyListener hasn't been added. - */ - virtual void removeGlobalKeyListener(KeyListener* keyListener); - - protected: - /** - * Handles all mouse input. - * - * @since 0.6.0 - */ - virtual void handleMouseInput(); - - /** - * Handles key input. - * - * @since 0.6.0 - */ - virtual void handleKeyInput(); - - /** - * Handles mouse moved input. - * - * @param mouseInput the mouse input to handle. - * @since 0.6.0 - */ - virtual void handleMouseMoved(const MouseInput& mouseInput); - - /** - * Handles mouse pressed input. - * - * @param mouseInput the mouse input to handle. - * @since 0.6.0 - */ - virtual void handleMousePressed(const MouseInput& mouseInput); - - /** - * - * Handles mouse wheel moved down input. - * - * @param mouseInput the mouse input to handle. - * @since 0.6.0 - */ - virtual void handleMouseWheelMovedDown(const MouseInput& mouseInput); - - /** - * Handles mouse wheel moved up input. - * - * @param mouseInput the mouse input to handle. - * @since 0.6.0 - */ - virtual void handleMouseWheelMovedUp(const MouseInput& mouseInput); - - /** - * Handles mouse released input. - * - * @param mouseInput the mouse input to handle. - * @since 0.6.0 - */ - virtual void handleMouseReleased(const MouseInput& mouseInput); - - /** - * Handles modal focus. Modal focus needs to be checked at - * each logic iteration as it might be necessary to distribute - * mouse entered or mouse exited events. - * - * @since 0.8.0 - */ - virtual void handleModalFocus(); - - /** - * Handles modal mouse input focus. Modal mouse input focus needs - * to be checked at each logic iteration as it might be necessary to - * distribute mouse entered or mouse exited events. - * - * @since 0.8.0 - */ - virtual void handleModalMouseInputFocus(); - - /** - * Handles modal focus gained. If modal focus has been gaind it might - * be necessary to distribute mouse entered or mouse exited events. - * - * @since 0.8.0 - */ - virtual void handleModalFocusGained(); - - /** - * Handles modal mouse input focus gained. If modal focus has been gaind - * it might be necessary to distribute mouse entered or mouse exited events. - * - * @since 0.8.0 - */ - virtual void handleModalFocusReleased(); - - /** - * Distributes a mouse event. - * - * @param type The type of the event to distribute, - * @param button The button of the event (if any used) to distribute. - * @param x The x coordinate of the event. - * @param y The y coordinate of the event. - * @param fource indicates whether the distribution should be forced or not. - * A forced distribution distributes the event even if a widget - * is not enabled, not visible, another widget has modal - * focus or another widget has modal mouse input focus. - * Default value is false. - * @param toSourceOnly indicates whether the distribution should be to the - * source widget only or to it's parent's mouse listeners - * as well. - * - * @since 0.6.0 - */ - virtual void distributeMouseEvent(Widget* source, - int type, - int button, - int x, - int y, - bool force = false, - bool toSourceOnly = false); - - /** - * Distributes a key event. - * - * @param keyEvent the key event to distribute. - - * @since 0.6.0 - */ - virtual void distributeKeyEvent(KeyEvent& keyEvent); - - /** - * Distributes a key event to the global key listeners. - * - * @param keyEvent the key event to distribute. - * - * @since 0.6.0 - */ - virtual void distributeKeyEventToGlobalKeyListeners(KeyEvent& keyEvent); - - /** - * Gets the widget at a certain position. - * - * @return the widget at a certain position. - * @since 0.6.0 - */ - virtual Widget* getWidgetAt(int x, int y); - - /** - * Gets the source of the mouse event. - * - * @return the source widget of the mouse event. - * @since 0.6.0 - */ - virtual Widget* getMouseEventSource(int x, int y); - - /** - * Gets the source of the key event. - * - * @return the source widget of the key event. - * @since 0.6.0 - */ - virtual Widget* getKeyEventSource(); - - Widget* mTop; - Graphics* mGraphics; - Input* mInput; - FocusHandler* mFocusHandler; - - bool mTabbing; - - typedef std::list KeyListenerList; - typedef KeyListenerList::iterator KeyListenerListIterator; - - KeyListenerList mKeyListeners; - - // Current input state - bool mShiftPressed; - bool mMetaPressed; - bool mControlPressed; - bool mAltPressed; - - // Last mouse state - unsigned int mLastMousePressButton; - int mLastMousePressTimeStamp; - int mLastMouseX; - int mLastMouseY; - int mClickCount; - int mLastMouseDragButton; - - // Widget with mouse stack - std::deque mWidgetWithMouseQueue; - }; -} - -#endif // end GCN_GUI_HPP - -/* yakslem - "Women, it's a constant struggle." - * finalman - "Yes, but sometimes they succeed with their guesses." - * yaklsem - "...eh...I was talking about love." - * finalman - "Oh...ok..." - * An awkward silence followed. - */ diff --git a/src/include/guisan/image.hpp b/src/include/guisan/image.hpp deleted file mode 100644 index 37244130..00000000 --- a/src/include/guisan/image.hpp +++ /dev/null @@ -1,178 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/platform.hpp" - -namespace gcn -{ - class Color; - class ImageLoader; - - /** - * Holds an image. To be able to use this class you must first set an - * ImageLoader in Image by calling - * @code Image::setImageLoader(myImageLoader) @endcode - * The function is static. If this is not done, the constructor taking a - * filename will throw an exception. The ImageLoader you use must be - * compatible with the Graphics object you use. - * - * EXAMPLE: If you use SDLGraphics you should use SDLImageLoader. - * Otherwise your program will crash in a most bizarre way. - */ - class GCN_CORE_DECLSPEC Image - { - public: - - /** - * Constructor. - */ - Image(); - - /** - * Destructor. - */ - virtual ~Image(); - - /** - * Loads an image by calling the Image class' ImageLoader. - * - * NOTE: The functions getPixel and putPixel are only guaranteed to work - * before an image has been converted to display format. - * - * @param filename the file to load. - * @param convertToDisplayFormat true if the image should be converted - * to display, false otherwise. - */ - static Image* load(const std::string& filename, bool convertToDisplayFormat = true); - - /** - * Gets the ImageLoader used for loading Images. - * - * @return the ImageLoader used for loading Images. - * @see SDLImageLoader, AllegroImageLoader - */ - static ImageLoader* getImageLoader(); - - /** - * Sets the ImageLoader to be used for loading images. - * - * IMPORTANT: The ImageLoader is static and MUST be set before loading - * images! - * - * @param imageLoader the ImageLoader to be used for loading images. - * @see SDLImageLoader, AllegroImageLoader - */ - static void setImageLoader(ImageLoader* imageLoader); - - /** - * Frees an image. - */ - virtual void free() = 0; - - /** - * Gets the width of the Image. - * - * @return the image width - */ - virtual int getWidth() const = 0; - - /** - * Gets the height of the Image. - * - * @return the image height - */ - virtual int getHeight() const = 0; - - /** - * Gets the color of a pixel at coordinate (x, y) in the image. - * - * IMPORTANT: Only guaranteed to work before the image has been - * converted to display format. - * - * @param x the x coordinate. - * @param y the y coordinate. - * @return the color of the pixel. - */ - virtual Color getPixel(int x, int y) = 0; - - /** - * Puts a pixel with a certain color at coordinate (x, y). - * - * @param x the x coordinate. - * @param y the y coordinate. - * @param color the color of the pixel to put. - */ - virtual void putPixel(int x, int y, const Color& color) = 0; - - /** - * Converts the image, if possible, to display format. - * - * IMPORTANT: Only guaranteed to work before the image has been - * converted to display format. - */ - virtual void convertToDisplayFormat() = 0; - - protected: - static ImageLoader* mImageLoader; - }; -} - -#endif // end GCN_IMAGE_HPP diff --git a/src/include/guisan/imagefont.hpp b/src/include/guisan/imagefont.hpp deleted file mode 100644 index fb148b08..00000000 --- a/src/include/guisan/imagefont.hpp +++ /dev/null @@ -1,213 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/font.hpp" -#include "guisan/platform.hpp" -#include "guisan/rectangle.hpp" - -namespace gcn -{ - class Color; - class Graphics; - class Image; - - /** - * A font using an image containing the font data. It implements the font - * class. You can use any filetype for the font data as long as it can be - * loaded with your ImageLoader. - * - * This are two examples of an image containing a font. - * \image html imagefontexample.bmp - * \image html imagefontexample2.bmp - * - * The Image font format works like this: The first pixel, the pixal at - * coordinate (0,0), tells which color to look for when seperating glyphs. - * You create an image with your glyphs and simple separates them with - * the seperation color. When you create your ImageFont you supply the - * constructor with the glyphs present in your image. When creating an - * ImageFont for the image data in the first example above, the following - * constructor call would be used. - * @code gcn::ImageFont imageFont("fixedfont_big.bmp"," abcdefghijklmno\ -pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); @endcode - * Noteworthy is that the first glyph actually gives the width of space. - * Glyphs can, as seen in the second example above, be seperated with - * horizontal lines making it possible to draw glyphs on more then one - * line in the image. However, these vertical lines must be of one pixel - * size! - */ - class GCN_CORE_DECLSPEC ImageFont: public Font - { - public: - - /** - * Constructor which takes an image file containing the font and - * a string containing the glyphs. The glyphs in the string should - * be in the same order as they appear in the font image. - * - * @param filename the filename of the image. - * @param glyphs the glyphs found in the image. - * @throws Exception when glyph list is incorrect or the font file is - * corrupt or if no ImageLoader exists. - */ - ImageFont(const std::string& filename, const std::string& glyphs); - - /** - * Constructor which takes an image file containing the font and - * two boundaries of ASCII values. The font image should include - * all glyphs specified with the boundaries in increasing ASCII - * order. The boundaries are inclusive. - * - * @param filename the filename of the image. - * @param glyphsFrom the ASCII value of the first glyph found in the - * image. - * @param glyphsTo the ASCII value of the last glyph found in the - * image. - * @throws Exception when glyph bondaries are incorrect or the font - * file is corrupt or if no ImageLoader exists. - */ - ImageFont(const std::string& filename, unsigned char glyphsFrom=32, - unsigned char glyphsTo=126); - - /** - * Destructor. - */ - virtual ~ImageFont(); - - /** - * Draws a glyph. - * - * NOTE: You normally won't use this function to draw text since - * the Graphics class contains better functions for drawing - * text. - * - * @param graphics a graphics object to be used for drawing. - * @param glyph a glyph to draw. - * @param x the x coordinate where to draw the glyph. - * @param y the y coordinate where to draw the glyph. - * @return the width of the glyph in pixels. - * @see Graphics - */ - virtual int drawGlyph(Graphics* graphics, unsigned char glyph, - int x, int y); - - /** - * Sets the spacing between rows in pixels. Default is 0 pixels. - * The spacing can be negative. - * - * @param spacing the spacing in pixels. - */ - virtual void setRowSpacing(int spacing); - - /** - * Gets the spacing between rows in pixels. - * - * @return the spacing. - */ - virtual int getRowSpacing(); - - /** - * Sets the spacing between letters in pixels. Default is 0 pixels. - * The spacing can be negative. - * - * @param spacing the spacing in pixels - */ - virtual void setGlyphSpacing(int spacing); - - /** - * Gets the spacing between letters in pixels. - * - * @return the spacing. - */ - virtual int getGlyphSpacing(); - - /** - * Gets a width of a glyph. - * - * @param glyph the glyph which width will be returned - * @return the width of a glyph - */ - virtual int getWidth(unsigned char glyph) const; - - - // Inherited from Font - - virtual int getWidth(const std::string& text) const; - - virtual void drawString(Graphics* graphics, const std::string& text, - int x, int y); - - virtual int getHeight() const; - - virtual int getStringIndexAt(const std::string& text, int x); - - protected: - void addGlyph(unsigned char c, int &x, int &y, const Color& separator); - - Rectangle mGlyph[256]; - int mHeight; - int mGlyphSpacing; - int mRowSpacing; - Image* mImage; - std::string mFilename; - }; -} - -#endif // end GCN_IMAGEFONT_HPP diff --git a/src/include/guisan/imageloader.hpp b/src/include/guisan/imageloader.hpp deleted file mode 100644 index a53c9b19..00000000 --- a/src/include/guisan/imageloader.hpp +++ /dev/null @@ -1,96 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/platform.hpp" - -namespace gcn -{ - class Image; - - /** - * ImageLoaders base class. Contains basic image loading functions every - * image loader should have. Image loaders should inherit from this - * class and impements it's functions. - */ - class GCN_CORE_DECLSPEC ImageLoader - { - public: - - /** - * Destructor. - */ - virtual ~ImageLoader() { } - - /** - * Loads an image by calling the image's ImageLoader. - * - * NOTE: The functions getPixel and putPixel in Image are only guaranteed to - * work before an image has been converted to display format. - * - * @param filename the file to load. - * @param convertToDisplayFormat true if the image should be converted - * to display, false otherwise. - */ - virtual Image* load(const std::string& filename, bool convertToDisplayFormat = true) = 0; - }; -} - -#endif // end GCN_IMAGELOADER_HPP diff --git a/src/include/guisan/input.hpp b/src/include/guisan/input.hpp deleted file mode 100644 index 33b15b99..00000000 --- a/src/include/guisan/input.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/platform.hpp" - -namespace gcn -{ - /** - * Represents a list. It is used in certain Widgets, like the ListBox, to - * handle a list with string elements. If you want to use Widgets like - * ListBox, you should inherit from this class and implement it's - * functions. - */ - class GCN_CORE_DECLSPEC ListModel - { - - public: - /** - * Destructor. - */ - virtual ~ListModel() { } - - /** - * Gets the number of elements in the ListModel. - * - * @return the number of elements in the ListModel - */ - virtual int getNumberOfElements() = 0; - - /** - * Gets an element at a certain index in the list. - * - * @param i an index in the list. - * @return an element as a string. - */ - virtual std::string getElementAt(int i) = 0; - }; -} - -#endif // end GCN_LISTMODEL_HPP diff --git a/src/include/guisan/mouseevent.hpp b/src/include/guisan/mouseevent.hpp deleted file mode 100644 index e0ed0db2..00000000 --- a/src/include/guisan/mouseevent.hpp +++ /dev/null @@ -1,178 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include - -#include "guisan/platform.hpp" - -extern "C" -{ - /** - * Exists to be able to check for Guichan OpenGL with autotools. - */ - GCN_EXTENSION_DECLSPEC extern void gcnOpenGL(); -} - -#endif // end GCN_OPENGL_HPP diff --git a/src/include/guisan/opengl/openglgraphics.hpp b/src/include/guisan/opengl/openglgraphics.hpp deleted file mode 100644 index 0456234f..00000000 --- a/src/include/guisan/opengl/openglgraphics.hpp +++ /dev/null @@ -1,141 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#if defined (DELETE) -#undef DELETE -#endif -#endif - -#if defined (__APPLE__) -#include -#else -#include -#endif - -#include - -#include "guisan/color.hpp" -#include "guisan/platform.hpp" -#include "guisan/image.hpp" - -namespace gcn -{ - /** - * OpenGL implementation of Image. - */ - class GCN_EXTENSION_DECLSPEC OpenGLImage : public Image - { - public: - /** - * Constructor. Loads an image from an array of pixels. The pixel array is - * is copied in the constructor and should thus be freed after the constructor - * has been called. - * - * NOTE: The functions getPixel and putPixel are only guaranteed to work - * before an image has been converted to display format. - * - * @param pixels to load from. - * @param width the width of the image. - * @param height the height of the image. - * @param convertToDisplayFormat true if the image should be converted - * to display, false otherwise. - */ - OpenGLImage(unsigned int* pixels, int width, int height, bool convertToDisplayFormat = true); - - /** - * Constructor. Load an image from an OpenGL texture handle. The width - * and height specifies the size of the "interesting" part of the - * texture, the real width and height of the texture are assumed to - * be the closest higher power of two. - * - * @param textureHandle the texture handle from which to load. - * @param width the width of the image. - * @param height the height of the image. - * @param autoFree true if the surface should automatically be deleted. - */ - OpenGLImage(GLuint textureHandle, int width, int height, bool autoFree); - - /** - * Destructor. - */ - virtual ~OpenGLImage(); - - /** - * Gets the OpenGL texture handle for the image. - * - * @return the OpenGL texture handle for the image. - */ - - virtual GLuint getTextureHandle() const; - - /** - * Gets the width of texture. - * - * @return the width of the texture. - */ - virtual int getTextureWidth() const; - - /** - * Gets the height of the texture. - * - * @return the height of the texture. - */ - virtual int getTextureHeight() const; - - - // Inherited from Image - - virtual void free(); - - virtual int getWidth() const; - - virtual int getHeight() const; - - virtual Color getPixel(int x, int y); - - virtual void putPixel(int x, int y, const Color& color); - - virtual void convertToDisplayFormat(); - - protected: - GLuint mTextureHandle; - unsigned int* mPixels; - bool mAutoFree; - int mWidth; - int mHeight; - int mTextureWidth; - int mTextureHeight; - - }; -} - -#endif // end GCN_OPENGLIMAGE_HPP diff --git a/src/include/guisan/opengl/openglsdlimageloader.hpp b/src/include/guisan/opengl/openglsdlimageloader.hpp deleted file mode 100644 index a4e0dfff..00000000 --- a/src/include/guisan/opengl/openglsdlimageloader.hpp +++ /dev/null @@ -1,109 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include -#include - -namespace gcn -{ - class Image; - - /** - * OpenGL ImageLoader that loads images with SDL. - */ - class OpenGLSDLImageLoader : public SDLImageLoader - { - public: - - // Inherited from ImageLoader - - virtual Image* load(const std::string& filename, - bool convertToDisplayFormat = true) - { - SDL_Surface *loadedSurface = loadSDLSurface(filename); - - if (loadedSurface == NULL) - { - throw GCN_EXCEPTION( - std::string("Unable to load image file: ") + filename); - } - - SDL_Surface *surface = convertToStandardFormat(loadedSurface); - SDL_FreeSurface(loadedSurface); - - if (surface == NULL) - { - throw GCN_EXCEPTION( - std::string("Not enough memory to load: ") + filename); - } - - OpenGLImage *image = new OpenGLImage((unsigned int*)surface->pixels, - surface->w, - surface->h, - convertToDisplayFormat); - SDL_FreeSurface(surface); - - return image; - } - }; -} - -#endif // end GCN_OPENGLSDLIMAGELOADER_HPP diff --git a/src/include/guisan/platform.hpp b/src/include/guisan/platform.hpp deleted file mode 100644 index b7a7609f..00000000 --- a/src/include/guisan/platform.hpp +++ /dev/null @@ -1,92 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include -#include -#include - -#include "platform.hpp" - -extern "C" -{ - /** - * Exists to be able to check for Guichan SDL with autotools. - */ - GCN_EXTENSION_DECLSPEC extern void gcnSDL(); -} - -#endif // end GCN_SDL_HPP diff --git a/src/include/guisan/sdl/sdlgraphics.hpp b/src/include/guisan/sdl/sdlgraphics.hpp deleted file mode 100644 index 8bd1231e..00000000 --- a/src/include/guisan/sdl/sdlgraphics.hpp +++ /dev/null @@ -1,164 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/color.hpp" -#include "guisan/platform.hpp" -#include "guisan/image.hpp" - -namespace gcn -{ - /** - * SDL implementation of Image. - */ - class GCN_EXTENSION_DECLSPEC SDLImage : public Image - { - public: - /** - * Constructor. Load an image from an SDL surface. - * - * NOTE: The functions getPixel and putPixel are only guaranteed to work - * before an image has been converted to display format. - * - * @param surface the surface from which to load. - * @param autoFree true if the surface should automatically be deleted. - */ - SDLImage(SDL_Surface* surface, bool autoFree); - - /** - * Destructor. - */ - virtual ~SDLImage(); - - /** - * Gets the SDL surface for the image. - * - * @return the SDL surface for the image. - */ - virtual SDL_Surface* getSurface() const; - - - // Inherited from Image - - virtual void free(); - - virtual int getWidth() const; - - virtual int getHeight() const; - - virtual Color getPixel(int x, int y); - - virtual void putPixel(int x, int y, const Color& color); - - virtual void convertToDisplayFormat(); - - protected: - SDL_Surface* mSurface; - bool mAutoFree; - }; -} - -#endif // end GCN_SDLIMAGE_HPP diff --git a/src/include/guisan/sdl/sdlimageloader.hpp b/src/include/guisan/sdl/sdlimageloader.hpp deleted file mode 100644 index 5d4455f1..00000000 --- a/src/include/guisan/sdl/sdlimageloader.hpp +++ /dev/null @@ -1,86 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "SDL.h" - -#include "guisan/input.hpp" -#include "guisan/keyinput.hpp" -#include "guisan/mouseinput.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - class Key; - - /** - * SDL implementation of Input. - */ - class GCN_EXTENSION_DECLSPEC SDLInput : public Input - { - public: - - /** - * Constructor. - */ - SDLInput(); - - /** - * Pushes an SDL event. It should be called at least once per frame to - * update input with user input. - * - * @param event an event from SDL. - */ - virtual void pushInput(SDL_Event event); - - /** - * Polls all input. It exists for input driver compatibility. If you - * only use SDL and plan sticking with SDL you can safely ignore this - * function as it in the SDL case does nothing. - */ - virtual void _pollInput() { } - - - // Inherited from Input - - virtual bool isKeyQueueEmpty(); - - virtual KeyInput dequeueKeyInput(); - - virtual bool isMouseQueueEmpty(); - - virtual MouseInput dequeueMouseInput(); - - protected: - /** - * Converts a mouse button from SDL to a Guichan mouse button - * representation. - * - * @param button an SDL mouse button. - * @return a Guichan mouse button. - */ - int convertMouseButton(int button); - - /** - * Converts an SDL event key to a key value. - * - * @param event an SDL event with a key to convert. - * @return a key value. - * @see Key - */ - int convertKeyCharacter(SDL_Event event); - - std::queue mKeyInputQueue; - std::queue mMouseInputQueue; - - bool mMouseDown; - bool mMouseInWindow; - }; -} - -#endif // end GCN_SDLINPUT_HPP diff --git a/src/include/guisan/sdl/sdlpixel.hpp b/src/include/guisan/sdl/sdlpixel.hpp deleted file mode 100644 index 0812bc0a..00000000 --- a/src/include/guisan/sdl/sdlpixel.hpp +++ /dev/null @@ -1,274 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1uformat->BytesPerPixel; - - SDL_LockSurface(surface); - - Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; - - unsigned int color = 0; - - switch(bpp) - { - case 1: - color = *p; - break; - - case 2: - color = *(Uint16 *)p; - break; - - case 3: - if(SDL_BYTEORDER == SDL_BIG_ENDIAN) - { - color = p[0] << 16 | p[1] << 8 | p[2]; - } - else - { - color = p[0] | p[1] << 8 | p[2] << 16; - } - break; - - case 4: - color = *(Uint32 *)p; - break; - - } - - unsigned char r,g,b,a; - - SDL_GetRGBA(color, surface->format, &r, &g, &b, &a); - SDL_UnlockSurface(surface); - - return Color(r,g,b,a); - } - - /** - * Puts a pixel on an SDL_Surface. - * - * @param x the x coordinate on the surface. - * @param y the y coordinate on the surface. - * @param color the color the pixel should be in. - */ - inline void SDLputPixel(SDL_Surface* surface, int x, int y, const Color& color) - { - int bpp = surface->format->BytesPerPixel; - - SDL_LockSurface(surface); - - Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; - - Uint32 pixel = SDL_MapRGB(surface->format, color.r, color.g, color.b); - - switch(bpp) - { - case 1: - *p = pixel; - break; - - case 2: - *(Uint16 *)p = pixel; - break; - - case 3: - if(SDL_BYTEORDER == SDL_BIG_ENDIAN) - { - p[0] = (pixel >> 16) & 0xff; - p[1] = (pixel >> 8) & 0xff; - p[2] = pixel & 0xff; - } - else - { - p[0] = pixel & 0xff; - p[1] = (pixel >> 8) & 0xff; - p[2] = (pixel >> 16) & 0xff; - } - break; - - case 4: - *(Uint32 *)p = pixel; - break; - } - - SDL_UnlockSurface(surface); - } - - /** - * Blends two 32 bit colors together. - * - * @param src the source color. - * @param dst the destination color. - * @param a alpha. - */ - inline unsigned int SDLAlpha32(unsigned int src, unsigned int dst, unsigned char a) - { - unsigned int b = ((src & 0xff) * a + (dst & 0xff) * (255 - a)) >> 8; - unsigned int g = ((src & 0xff00) * a + (dst & 0xff00) * (255 - a)) >> 8; - unsigned int r = ((src & 0xff0000) * a + (dst & 0xff0000) * (255 - a)) >> 8; - - return (b & 0xff) | (g & 0xff00) | (r & 0xff0000); - } - - /** - * Blends two 16 bit colors together. - * - * @param src the source color. - * @param dst the destination color. - * @param a alpha. - */ - inline unsigned short SDLAlpha16(unsigned short src, unsigned short dst, unsigned char a, const SDL_PixelFormat *f) - { - unsigned int b = ((src & f->Rmask) * a + (dst & f->Rmask) * (255 - a)) >> 8; - unsigned int g = ((src & f->Gmask) * a + (dst & f->Gmask) * (255 - a)) >> 8; - unsigned int r = ((src & f->Bmask) * a + (dst & f->Bmask) * (255 - a)) >> 8; - - return (unsigned short)((b & f->Rmask) | (g & f->Gmask) | (r & f->Bmask)); - } - - /* - typedef struct{ - SDL_Palette *palette; - Uint8 BitsPerPixel; - Uint8 BytesPerPixel; - Uint32 Rmask, Gmask, Bmask, Amask; - Uint8 Rshift, Gshift, Bshift, Ashift; - Uint8 Rloss, Gloss, Bloss, Aloss; - Uint32 colorkey; - Uint8 alpha; - } SDL_PixelFormat; - */ - - /** - * Puts a pixel on an SDL_Surface with alpha - * - * @param x the x coordinate on the surface. - * @param y the y coordinate on the surface. - * @param color the color the pixel should be in. - */ - inline void SDLputPixelAlpha(SDL_Surface* surface, int x, int y, const Color& color) - { - int bpp = surface->format->BytesPerPixel; - - SDL_LockSurface(surface); - - Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; - - Uint32 pixel = SDL_MapRGB(surface->format, color.r, color.g, color.b); - - switch(bpp) - { - case 1: - *p = pixel; - break; - - case 2: - *(Uint16 *)p = SDLAlpha16(pixel, *(Uint32 *)p, color.a, surface->format); - break; - - case 3: - unsigned int c; - if(SDL_BYTEORDER == SDL_BIG_ENDIAN) - { - unsigned int r = (p[0] * (255 - color.a) + color.r * color.a) >> 8; - unsigned int g = (p[1] * (255 - color.a) + color.g * color.a) >> 8; - unsigned int b = (p[2] * (255 - color.a) + color.b * color.a) >> 8; - - p[2] = b; - p[1] = g; - p[0] = r; - } - else - { - unsigned int r = (p[2] * (255 - color.a) + color.r * color.a) >> 8; - unsigned int g = (p[1] * (255 - color.a) + color.g * color.a) >> 8; - unsigned int b = (p[0] * (255 - color.a) + color.b * color.a) >> 8; - - p[0] = b; - p[1] = g; - p[2] = r; - } - break; - - case 4: - *(Uint32 *)p = SDLAlpha32(pixel, *(Uint32 *)p, color.a); - break; - } - - SDL_UnlockSurface(surface); - } -} - -#endif // end GCN_SDLPIXEL_HPP diff --git a/src/include/guisan/selectionevent.hpp b/src/include/guisan/selectionevent.hpp deleted file mode 100644 index 47646084..00000000 --- a/src/include/guisan/selectionevent.hpp +++ /dev/null @@ -1,91 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/selectionevent.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - /** - * Listener of value change events from Widgets. To be able to - * listen for value changes you must make a class which inherits - * from this class and implements the valueChanged function. - * - * @see ListBox::addSelectionListener - * @author Olof Naessén - * @since 0.8.0 - */ - class GCN_CORE_DECLSPEC SelectionListener - { - public: - - /** - * Destructor. - */ - virtual ~SelectionListener() { } - - /** - * Called when a value has been changed in a Widget. It is used - * to be able to recieve a notification that a value has been changed. - * - * @param event the event of the value change. - * @since 0.8.0 - */ - virtual void valueChanged(const SelectionEvent& event) { }; - - }; -} - -#endif // end GCN_SELECTIONLISTENER_HPP diff --git a/src/include/guisan/widget.hpp b/src/include/guisan/widget.hpp deleted file mode 100644 index eb28f596..00000000 --- a/src/include/guisan/widget.hpp +++ /dev/null @@ -1,877 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include - -#include "guisan/color.hpp" -#include "guisan/rectangle.hpp" - -namespace gcn -{ - class ActionListener; - class BasicContainer; - class DeathListener; - class DefaultFont; - class FocusHandler; - class FocusListener; - class Font; - class Graphics; - class KeyInput; - class KeyListener; - class MouseInput; - class MouseListener; - class WidgetListener; - - /** - * Widget base class. Contains basic widget functions every widget should - * have. Widgets should inherit from this class and implements it's - * functions. - * - * NOTE: Functions begining with underscore "_" should not - * be overloaded unless you know what you are doing - * - * @author Olof Naessén - * @author Per Larsson. - */ - class GCN_CORE_DECLSPEC Widget - { - public: - /** - * Constructor. Resets member variables. Noteable, a widget is not - * focusable as default, therefore, widgets that are supposed to be - * focusable should overide this default in their own constructor. - */ - Widget(); - - /** - * Default destructor. - */ - virtual ~Widget(); - - /** - * Draws the widget. It is called by the parent widget when it is time - * for the widget to draw itself. The graphics object is set up so - * that all drawing is relative to the widget, i.e coordinate (0,0) is - * the top-left corner of the widget. It is not possible to draw - * outside of a widgets dimension. - * - * @param graphics a Graphics object to draw with. - */ - virtual void draw(Graphics* graphics) = 0; - - /** - * Draws the widget border. A border is drawn around a widget. - * The width and height of the border is therefore the widgets - * height+2*bordersize. Think of a painting that has a certain size, - * the border surrounds the painting. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawBorder(Graphics* graphics) { } - - /** - * Called for all widgets in the gui each time Gui::logic is called. - * You can do logic stuff here like playing an animation. - * - * @see Gui - */ - virtual void logic() { } - - /** - * Gets the widget parent container. - * - * @return the widget parent container. Returns NULL if the widget - * has no parent. - */ - virtual Widget* getParent() const; - - /** - * Sets the width of the widget in pixels. - * - * @param width the widget width in pixels. - */ - void setWidth(int width); - - /** - * Gets the width of the widget in pixels. - * - * @return the widget with in pixels. - */ - int getWidth() const; - - /** - * Sets the height of the widget in pixels. - * - * @param height the widget height in pixels. - */ - void setHeight(int height); - - /** - * Gets the height of the widget in pixels. - * - * @return the widget height in pixels. - */ - int getHeight() const; - - /** - * Sets the size of the widget. - * - * @param width the width. - * @param height the height. - */ - void setSize(int width, int height); - - /** - * Set the widget x coordinate. It is relateive to it's parent. - * - * @param x the widget x coordinate. - */ - void setX(int x); - - /** - * Gets the widget x coordinate. It is relative to it's parent. - * - * @return the widget x coordinate. - */ - int getX() const; - - /** - * Set the widget y coordinate. It is relative to it's parent. - * - * @param y the widget y coordinate. - */ - void setY(int y); - - /** - * Gets the widget y coordinate. It is relative to it's parent. - * - * @return the widget y coordinate. - */ - int getY() const; - - /** - * Sets the widget position. It is relative to it's parent. - * - * @param x the widget x coordinate. - * @param y the widgets y coordinate. - */ - void setPosition(int x, int y); - - /** - * Sets the dimension of the widget. It is relative to it's parent. - * - * @param dimension the widget dimension. - */ - void setDimension(const Rectangle& dimension); - - /** - * Sets the size of the border, or the width if you so like. The size - * is the number of pixels that the border extends outside the widget. - * Border size = 0 means no border. - * - * @param borderSize the size of the border. - * @see drawBorder - */ - void setBorderSize(unsigned int borderSize); - - /** - * Gets the size of the border, or the width if you so like. The size - * is the number of pixels that the border extends outside the widget. - * Border size = 0 means no border. - * - * @return the size of the border. - * @see drawBorder - */ - unsigned int getBorderSize() const; - - /** - * Gets the dimension of the widget. It is relative to it's parent. - * - * @return the widget dimension. - */ - const Rectangle& getDimension() const; - - /** - * Sets a widgets focusability. - * - * @param focusable true if the widget should be focusable. - */ - void setFocusable(bool focusable); - - /** - * Checks whether the widget is focusable. - * - * @return true if the widget is focusable. - */ - bool isFocusable() const; - - /** - * Checks if the widget is focused. - * - * @return true if the widget currently has focus. - */ - virtual bool isFocused() const; - - /** - * Sets the widget to be disabled or enabled. A disabled - * widget will never recieve mouse or key input. - * - * @param enabled true if widget is enabled. - */ - void setEnabled(bool enabled); - - /** - * Checks if a widget is disabled or not. - * - * @return true if the widget should be enabled. - */ - bool isEnabled() const; - - /** - * Sets the widget to be visible. - * - * @param visible true if the widget should be visiable. - */ - void setVisible(bool visible); - - /** - * Checks if the widget is visible. - * - * @return true if the widget is visible. - */ - bool isVisible() const; - - /** - * Sets the base color. The base color is the background - * color for many widgets like the Button and Contianer widgets. - * - * @param color the baseground color. - */ - void setBaseColor(const Color& color); - - /** - * Gets the base color. - * - * @return the foreground color. - */ - const Color& getBaseColor() const; - - /** - * Sets the foreground color. - * - * @param color the foreground color. - */ - void setForegroundColor(const Color& color); - - /** - * Gets the foreground color. - * - * @return the foreground color. - */ - const Color& getForegroundColor() const; - - /** - * Sets the background color. - * - * @param color the background Color. - */ - void setBackgroundColor(const Color& color); - - /** - * Gets the background color. - * - * @return the background color. - */ - const Color& getBackgroundColor() const; - - /** - * Sets the selection color. - * - * @param color the selection color. - */ - void setSelectionColor(const Color& color); - - /** - * Gets the selection color. - * - * @return the selection color. - */ - const Color& getSelectionColor() const; - - /** - * Requests focus for the widget. A widget will only recieve focus - * if it is focusable. - */ - virtual void requestFocus(); - - /** - * Requests a move to the top in the parent widget. - */ - virtual void requestMoveToTop(); - - /** - * Requests a move to the bottom in the parent widget. - */ - virtual void requestMoveToBottom(); - - /** - * Sets the FocusHandler to be used. - * - * WARNING: This function is used internally and should not - * be called or overloaded unless you know what you - * are doing. - * - * @param focusHandler the FocusHandler to use. - */ - virtual void _setFocusHandler(FocusHandler* focusHandler); - - /** - * Gets the FocusHandler used. - * - * WARNING: This function is used internally and should not - * be called or overloaded unless you know what you - * are doing. - * - * @return the FocusHandler used. - */ - virtual FocusHandler* _getFocusHandler(); - - /** - * Adds an ActionListener to the widget. When an action is triggered - * by the widget, the action function in all the widget's - * ActionListeners will be called. - * - * @param actionListener the ActionListener to add. - */ - void addActionListener(ActionListener* actionListener); - - /** - * Removes an added ActionListener from the widget. - * - * @param actionListener the ActionListener to remove. - */ - void removeActionListener(ActionListener* actionListener); - - /** - * Adds a DeathListener to the widget. When the widget dies - * the death function in all the widget's DeathListeners will be called. - * - * @param actionListener the DeathListener to add. - */ - void addDeathListener(DeathListener* deathListener); - - /** - * Removes an added DeathListener from the widget. - * - * @param deathListener the DeathListener to remove. - */ - void removeDeathListener(DeathListener* deathListener); - - /** - * Adds a MouseListener to the widget. When a mouse message is - * recieved, it will be sent to the widget's MouseListeners. - * - * @param mouseListener the MouseListener to add. - */ - void addMouseListener(MouseListener* mouseListener); - - /** - * Removes an added MouseListener from the widget. - * - * @param mouseListener the MouseListener to remove. - */ - void removeMouseListener(MouseListener* mouseListener); - - /** - * Adds a KeyListener to the widget. When a key message is recieved, - * it will be sent to the widget's KeyListeners. - * - * @param keyListener the KeyListener to add. - */ - void addKeyListener(KeyListener* keyListener); - - /** - * Removes an added KeyListener from the widget. - * - * @param keyListener the KeyListener to remove. - */ - void removeKeyListener(KeyListener* keyListener); - - /** - * Adds a FocusListener to the widget. When a focus event is recieved, - * it will be sent to the widget's FocusListeners. - * - * @param focusListener the FocusListener to add. - * @author Olof Naessén - * @since 0.7.0 - */ - void addFocusListener(FocusListener* focusListener); - - /** - * Removes an added FocusListener from the widget. - * - * @param focusListener the FocusListener to remove. - * @author Olof Naessén - * @since 0.7.0 - */ - void removeFocusListener(FocusListener* focusListener); - - /** - * Adds a WidgetListener to the widget. - * - * @param widgetListener the WidgetListener to add. - * @author Olof Naessén - * @since 0.8.0 - */ - void addWidgetListener(WidgetListener* widgetListener); - - /** - * Removes an added WidgetListener from the widget. - * - * @param widgetListener the WidgetListener to remove. - * @author Olof Naessén - * @since 0.8.0 - */ - void removeWidgetListener(WidgetListener* widgetListener); - - /** - * Sets the action event identifier of the widget. The identifier is - * used to be able to identify which action has occured. - * - * NOTE: An action event identifier should not be used to identify a - * certain widget but rather a certain event in your application. - * Several widgets can have the same action event identifer. - * - * @param actionEventId the action event identifier. - * @since 0.6.0 - */ - void setActionEventId(const std::string& actionEventId); - - /** - * Gets the action event identifier. - * - * @return the action event identifier. - */ - const std::string& getActionEventId() const; - - /** - * Gets the absolute position on the screen for the widget. - * - * @param x absolute x coordinate will be stored in this parameter. - * @param y absolute y coordinate will be stored in this parameter. - */ - virtual void getAbsolutePosition(int& x, int& y) const; - - /** - * Sets the parent of the widget. A parent must be a BasicContainer. - * - * WARNING: This function is used internally and should not - * be called or overloaded unless you know what you - * are doing. - * - * @param parent the parent BasicContainer.. - */ - virtual void _setParent(Widget* parent); - - /** - * Gets the font used. If no font has been set, the global font will - * be returned instead. If no global font has been set, the default - * font will be returend. - * ugly default. - * - * @return the used Font. - */ - Font *getFont() const; - - /** - * Sets the global font to be used by default for all widgets. - * - * @param font the global Font. - */ - static void setGlobalFont(Font* font); - - /** - * Sets the font. If font is NULL, the global font will be used. - * - * @param font the Font. - */ - void setFont(Font* font); - - /** - * Called when the font has changed. If the change is global, - * this function will only be called if the widget don't have a - * font already set. - */ - virtual void fontChanged() { } - - /** - * Checks whether a widget exists or not, that is if it still exists - * an instance of the object. - * - * @param widget the widget to check. - */ - static bool widgetExists(const Widget* widget); - - /** - * Check if tab in is enabled. Tab in means that you can set focus - * to this widget by pressing the tab button. If tab in is disabled - * then the FocusHandler will skip this widget and focus the next - * in its focus order. - * - * @return true if tab in is enabled. - */ - bool isTabInEnabled() const; - - /** - * Sets tab in enabled. Tab in means that you can set focus - * to this widget by pressing the tab button. If tab in is disabled - * then the FocusHandler will skip this widget and focus the next - * in its focus order. - * - * @param enabled true if tab in should be enabled. - */ - void setTabInEnabled(bool enabled); - - /** - * Checks if tab out is enabled. Tab out means that you can lose - * focus to this widget by pressing the tab button. If tab out is - * disabled then the FocusHandler ignores tabbing and focus will - * stay with this widget. - * - * @return true if tab out is enabled. - */ - bool isTabOutEnabled() const; - - /** - * Sets tab out enabled. Tab out means that you can lose - * focus to this widget by pressing the tab button. If tab out is - * disabled then the FocusHandler ignores tabbing and focus will - * stay with this widget. - * - * @param enabled true if tab out should be enabled. - */ - void setTabOutEnabled(bool enabled); - - /** - * Requests modal focus. When a widget has modal focus, only that - * widget and it's children may recieve input. - * - * @throws Exception if another widget already has modal focus. - */ - virtual void requestModalFocus(); - - /** - * Requests modal mouse input focus. When a widget has modal input focus - * that widget will be the only widget receiving input even if the input - * occurs outside of the widget and no matter what the input is. - * - * @throws Exception if another widget already has modal focus. - * @since 0.6.0 - */ - virtual void requestModalMouseInputFocus(); - - /** - * Releases modal focus. Modal focus will only be released if the - * widget has modal focus. - */ - virtual void releaseModalFocus(); - - /** - * Releases modal mouse input focus. Modal mouse input focus will only - * be released if the widget has modal mouse input focus. - * - * @since 0.6.0 - */ - virtual void releaseModalMouseInputFocus(); - - /** - * Checks if the widget or it's parent has modal focus. - */ - virtual bool hasModalFocus() const; - - /** - * Checks if the widget or it's parent has modal mouse input focus. - * - * @since 0.6.0 - */ - virtual bool hasModalMouseInputFocus() const; - - /** - * Gets a widget from a certain position in the widget. - * This function is used to decide which gets mouse input, - * thus it can be overloaded to change that behaviour. - * - * NOTE: This always returns NULL if the widget is not - * a container. - * - * @param x the x coordinate. - * @param y the y coordinate. - * @return the widget at the specified coodinate, or NULL - * if no such widget exists. - * @since 0.6.0 - */ - virtual Widget *getWidgetAt(int x, int y); - - /** - * Gets the mouse listeners of the widget. - * - * @return the mouse listeners of the widget. - * @since 0.6.0 - */ - virtual const std::list& _getMouseListeners(); - - /** - * Gets the key listeners of the widget. - * - * @return the key listeners of the widget. - * @since 0.6.0 - */ - virtual const std::list& _getKeyListeners(); - - /** - * Gets the focus listeners of the widget. - * - * @return the focus listeners of the widget. - * @since 0.7.0 - */ - virtual const std::list& _getFocusListeners(); - - /** - * Gets the subarea of the widget that the children occupy. - * - * @return the subarea as a Rectangle. - */ - virtual Rectangle getChildrenArea(); - - /** - * Gets the internal FocusHandler used. - * - * @return the internalFocusHandler used. If no internal FocusHandler - * is used, NULL will be returned. - */ - virtual FocusHandler* _getInternalFocusHandler(); - - /** - * Sets the internal FocusHandler. An internal focushandler is - * needed if both a widget in the widget and the widget itself - * should be foucsed at the same time. - * - * @param focusHandler the FocusHandler to be used. - */ - void setInternalFocusHandler(FocusHandler* focusHandler); - - /** - * Moves a widget to the top of this widget. The moved widget will be - * drawn above all other widgets in this widget. - * - * @param widget the widget to move. - */ - virtual void moveToTop(Widget* widget) { }; - - /** - * Moves a widget in this widget to the bottom of this widget. - * The moved widget will be drawn below all other widgets in this widget. - * - * @param widget the widget to move. - */ - virtual void moveToBottom(Widget* widget) { }; - - /** - * Focuses the next widget in the widget. - */ - virtual void focusNext() { }; - - /** - * Focuses the previous widget in the widget. - */ - virtual void focusPrevious() { }; - - /** - * Tries to show a specific part of a widget by moving it. Used if the - * widget should act as a container. - * - * @param widget the target widget. - * @param area the area to show. - */ - virtual void showWidgetPart(Widget* widget, Rectangle area) { }; - - /** - * Sets an id of a widget. An id can be useful if a widget needs to be - * identified in a container. For example, if widgets are created by an - * XML document, a certain widget can be retrieved given that the widget - * has an id. - * - * @param id the id to set to the widget. - * @see BasicContainer::findWidgetById - */ - void setId(const std::string& id); - - /** - * Gets the id of a widget. An id can be useful if a widget needs to be - * identified in a container. For example, if widgets are created by an - * XML document, a certain widget can be retrieved given that the widget - * has an id. - * - * @param id the id to set to the widget. - * @see BasicContainer::findWidgetById - */ - const std::string& getId(); - - protected: - /** - * Generates an action to the widget's ActionListeners. - */ - void generateAction(); - - /** - * Distributes resized events to all of the widget's listeners. - * - * @since 0.8.0 - * @author Olof Naessén - */ - void distributeResizedEvent(); - - /** - * Distributes moved events to all of the widget's listeners. - * - * @since 0.8.0 - * @author Olof Naessén - */ - void distributeMovedEvent(); - - /** - * Distributes hidden events to all of the widget's listeners. - * - * @since 0.8.0 - * @author Olof Naessén - */ - void distributeHiddenEvent(); - - /** - * Distributes shown events to all of the widget's listeners. - * - * @since 0.8.0 - * @author Olof Naessén - */ - void distributeShownEvent(); - - typedef std::list MouseListenerList; - typedef MouseListenerList::iterator MouseListenerIterator; - MouseListenerList mMouseListeners; - - typedef std::list KeyListenerList; - KeyListenerList mKeyListeners; - typedef KeyListenerList::iterator KeyListenerIterator; - - typedef std::list ActionListenerList; - ActionListenerList mActionListeners; - typedef ActionListenerList::iterator ActionListenerIterator; - - typedef std::list DeathListenerList; - DeathListenerList mDeathListeners; - typedef DeathListenerList::iterator DeathListenerIterator; - - typedef std::list FocusListenerList; - FocusListenerList mFocusListeners; - typedef FocusListenerList::iterator FocusListenerIterator; - - typedef std::list WidgetListenerList; - WidgetListenerList mWidgetListeners; - typedef WidgetListenerList::iterator WidgetListenerIterator; - - Color mForegroundColor; - Color mBackgroundColor; - Color mBaseColor; - Color mSelectionColor; - FocusHandler* mFocusHandler; - FocusHandler* mInternalFocusHandler; - Widget* mParent; - Rectangle mDimension; - unsigned int mBorderSize; - std::string mActionEventId; - bool mFocusable; - bool mVisible; - bool mTabIn; - bool mTabOut; - bool mEnabled; - std::string mId; - - Font* mCurrentFont; - static DefaultFont mDefaultFont; - static Font* mGlobalFont; - static std::list mWidgets; - }; -} - -#endif // end GCN_WIDGET_HPP - -/* - * yakslem - "I have a really great idea! Why not have an - * interesting and funny quote or story at the - * end of every source file." - * finalman - "Yeah - good idea! .... do you know any funny - * quotes?" - * yakslem - "Well.. I guess not. I just thought it would be - * fun to tell funny quotes." - * finalman - "That's not a very funny quote. But i believe - * pointless quotes are funny in their own pointless - * way." - * yakslem - "...eh...ok..." - */ diff --git a/src/include/guisan/widgetlistener.hpp b/src/include/guisan/widgetlistener.hpp deleted file mode 100644 index d63a7f16..00000000 --- a/src/include/guisan/widgetlistener.hpp +++ /dev/null @@ -1,123 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/event.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - /** - * Listener on events from a Widget. Whenever a widget changes it's - * size or position the listener of a widget will get notified. To be able to - * listen for events from a widget you must make a class which inherits - * from this class and implements it's functions. - * - * @see Widget::addWidgetListener - * @author Olof Naessén - * @since 0.8.0 - */ - class GCN_CORE_DECLSPEC WidgetListener - { - public: - - /** - * Destructor. - */ - virtual ~WidgetListener() { } - - /** - * Invoked when a widget changes its size. - * - * @param event Describes the event. - * @since 0.8.0 - */ - virtual void widgetResized(const Event& event) { } - - /** - * Invoked when a widget is moved. - * - * @param event Describes the event. - * @since 0.8.0 - */ - virtual void widgetMoved(const Event& event) { } - - /** - * Invoked when a widget is hidden, i.e it's set to be - * not visible. - * - * @param event Describes the event. - * @since 0.8.0 - */ - virtual void widgetHidden(const Event& event) { } - - /** - * Invoked when a widget is shown, i.e it's set to be - * visible. - * - * @param event Describes the event. - * @since 0.8.0 - */ - virtual void widgetShown(const Event& event) { } - - }; -} - -#endif // end GCN_WIDGETLISTENER_HPP diff --git a/src/include/guisan/widgets/button.hpp b/src/include/guisan/widgets/button.hpp deleted file mode 100644 index d120302e..00000000 --- a/src/include/guisan/widgets/button.hpp +++ /dev/null @@ -1,195 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/focuslistener.hpp" -#include "guisan/keylistener.hpp" -#include "guisan/mouseevent.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" - -namespace gcn -{ - /** - * A regular button. Add an ActionListener to it to know when it - * has been clicked. - * - * NOTE: You can only have text (a caption) on the button. If you want it - * to handle, for instance images, you can implement an ImageButton - * of your own and overload member functions from Button. - */ - class GCN_CORE_DECLSPEC Button : public Widget, - public MouseListener, - public KeyListener, - public FocusListener - { - public: - /** - * Constructor. - */ - Button(); - - /** - * Constructor. - * - * @param caption the caption of the Button. - */ - Button(const std::string& caption); - - /** - * Sets the Button caption. - * - * @param caption the Button caption. - */ - void setCaption(const std::string& caption); - - /** - * Gets the Button caption. - * - * @return the Button caption. - */ - const std::string& getCaption() const; - - /** - * Sets the alignment for the caption. - * - * @param alignment Graphics::LEFT, Graphics::CENTER or Graphics::RIGHT - * @see Graphics - */ - void setAlignment(unsigned int alignment); - - /** - * Gets the alignment for the caption. - * - * @return alignment of caption. - */ - unsigned int getAlignment() const; - - /** - * Sets the spacing between the border of this button and its caption. - * - * @param spacing is a number between 0 and 255. The default value for - spacing is 4 and can be changed using this method. - */ - void setSpacing(unsigned int spacing); - - /** - * Gets the spacing between the border of this button and its caption. - * - * @return spacing. - */ - unsigned int getSpacing() const; - - /** - * Adjusts the buttons size to fit the content. - */ - void adjustSize(); - - /** - * Checks if the button is pressed down. Useful when drawing. - * - * @return true if the button is pressed down. - */ - bool isPressed() const; - - - //Inherited from Widget - - virtual void draw(Graphics* graphics); - - virtual void drawBorder(Graphics* graphics); - - - // Inherited from FocusListener - - virtual void focusLost(const Event& event); - - - // Inherited from MouseListener - - virtual void mousePressed(MouseEvent& mouseEvent); - - virtual void mouseReleased(MouseEvent& mouseEvent); - - virtual void mouseEntered(MouseEvent& mouseEvent); - - virtual void mouseExited(MouseEvent& mouseEvent); - - virtual void mouseDragged(MouseEvent& mouseEvent); - - - // Inherited from KeyListener - - virtual void keyPressed(KeyEvent& keyEvent); - - virtual void keyReleased(KeyEvent& keyEvent); - - protected: - std::string mCaption; - bool mHasMouse; - bool mKeyPressed; - bool mMousePressed; - unsigned int mAlignment; - unsigned int mSpacing; - }; -} - -#endif // end GCN_BUTTON_HPP diff --git a/src/include/guisan/widgets/checkbox.hpp b/src/include/guisan/widgets/checkbox.hpp deleted file mode 100644 index 0820f7d1..00000000 --- a/src/include/guisan/widgets/checkbox.hpp +++ /dev/null @@ -1,188 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/keylistener.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" - -namespace gcn -{ - /** - * An implementation of a check box where a user can select or deselect - * the check box and where the status of the check box is displayed to the user. - * A check box is capable of displaying a caption. - * - * If a check box's state changes an action event will be sent to all action - * listeners of the check box. - */ - class GCN_CORE_DECLSPEC CheckBox : - public Widget, - public MouseListener, - public KeyListener - { - public: - - /** - * Contructor. - */ - CheckBox(); - - /** - * Constructor. The check box will be automatically resized - * to fit it's caption. - * - * @param caption The caption of the check box. - * @param marked True if the check box is selected, false otherwise. - */ - CheckBox(const std::string &caption, bool selected = false); - - /** - * Destructor. - */ - virtual ~CheckBox() { } - - /** - * Checks if the check box is selected. - * - * @return True if the check box is selected, false otherwise. - * @see setSelected - */ - bool isSelected() const; - - /** - * Sets the check box to be selected. - * - * @param selected True if the check box should be set as selected. - * @see isSelected - */ - void setSelected(bool selected); - - /** - * Gets the caption of the check box. - * - * @return The caption of the check box. - * @see setCaption - */ - const std::string &getCaption() const; - - /** - * Sets the caption of the check box. It's advisable to call - * adjustSize after setting of the caption to adjust the - * check box's size to fit the caption. - * - * @param caption The caption of the check box. - * @see getCaption, adjustSize - */ - void setCaption(const std::string& caption); - - /** - * Adjusts the check box's size to fit the caption. - */ - void adjustSize(); - - - // Inherited from Widget - - virtual void draw(Graphics* graphics); - - virtual void drawBorder(Graphics* graphics); - - - // Inherited from KeyListener - - virtual void keyPressed(KeyEvent& keyEvent); - - - // Inherited from MouseListener - - virtual void mouseClicked(MouseEvent& mouseEvent); - - virtual void mouseDragged(MouseEvent& mouseEvent); - - - protected: - /** - * Draws the box of the check box. - * - * @param graphics A Graphics object to draw with. - */ - virtual void drawBox(Graphics *graphics); - - /** - * Toggles the check box between being selected and - * not being selected. - */ - virtual void toggleSelected(); - - /** - * True if the check box is selected, false otherwise. - */ - bool mSelected; - - /** - * Holds the caption of the check box. - */ - std::string mCaption; - }; -} - -#endif // end GCN_CHECKBOX_HPP diff --git a/src/include/guisan/widgets/container.hpp b/src/include/guisan/widgets/container.hpp deleted file mode 100644 index ad6c0bc9..00000000 --- a/src/include/guisan/widgets/container.hpp +++ /dev/null @@ -1,177 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/basiccontainer.hpp" -#include "guisan/graphics.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - /** - * An implementation of a container able to contain other widgets. A widget's - * position in the container is relative to the container itself and not the screen. - * A container is the most common widget to use as the Gui's top widget as makes the Gui - * able to contain more than one widget. - * - * @see Gui::setTop - */ - class GCN_CORE_DECLSPEC Container: public BasicContainer - { - public: - - /** - * Constructor. A container is opauqe as default, if you want a - * none opaque container call setQpaque(false). - * - * @see setOpaque, isOpaque - */ - Container(); - - /** - * Destructor. - */ - virtual ~Container(); - - /** - * Sets the container to be opaque or not. If the container - * is opaque it's background will be drawn, if it's not opaque - * it's background will not be drawn, and thus making the container - * completely transparent. - * - * NOTE: This is not the same as to set visibility. A non visible - * container will not itself nor will it draw it's content. - * - * @param opaque True if the container should be opaque, false otherwise. - * @see isOpaque - */ - void setOpaque(bool opaque); - - /** - * Checks if the container is opaque or not. - * - * @return true if the container is opaque, false otherwise. - * @see setOpaque - */ - bool isOpaque() const; - - /** - * Adds a widget to the container. - * - * @param widget The widget to add. - * @see remove, clear - */ - virtual void add(Widget* widget); - - /** - * Adds a widget to the container and also specifices the widget's - * postion in the container. The position is relative to the container - * and not relative to the screen. - * - * @param widget The widget to add. - * @param x The x coordinat for the widget. - * @param y The y coordinat for the widget. - * @see remove, clear - */ - virtual void add(Widget* widget, int x, int y); - - /** - * Removes a widget from the Container. - * - * @param widget The widget to remove. - * @throws Exception when the widget has not been added to the - * container. - * @see add, clear - */ - virtual void remove(Widget* widget); - - /** - * Clears the container of all widgets. - * - * @see add, remove - */ - virtual void clear(); - - /** - * Finds a widget given an id. - * - * @param id The id to find a widget by. - * @return A widget with a corrosponding id, NULL if no widget - * is found. - * @see Widget::setId - */ - virtual Widget* findWidgetById(const std::string &id); - - - // Inherited from Widget - - virtual void draw(Graphics* graphics); - - virtual void drawBorder(Graphics* graphics); - - protected: - /** - * True if the container is opaque, false otherwise. - */ - bool mOpaque; - }; -} - -#endif // end GCN_CONTAINER_HPP diff --git a/src/include/guisan/widgets/dropdown.hpp b/src/include/guisan/widgets/dropdown.hpp deleted file mode 100644 index 89edc525..00000000 --- a/src/include/guisan/widgets/dropdown.hpp +++ /dev/null @@ -1,301 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u SelectionListenerList; - - /** - * The selection listener's of the drop down. - */ - SelectionListenerList mSelectionListeners; - - /** - * Typedef. - */ - typedef SelectionListenerList::iterator SelectionListenerIterator; - - }; -} - -#endif // end GCN_DROPDOWN_HPP diff --git a/src/include/guisan/widgets/icon.hpp b/src/include/guisan/widgets/icon.hpp deleted file mode 100644 index 63604145..00000000 --- a/src/include/guisan/widgets/icon.hpp +++ /dev/null @@ -1,113 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" - -namespace gcn -{ - /** - * Implementation of a label capable of displaying a caption. - */ - class GCN_CORE_DECLSPEC Label: public Widget - { - public: - /** - * Constructor. - */ - Label(); - - /** - * Constructor. - * - * @param caption The caption of the label. - */ - Label(const std::string& caption); - - /** - * Gets the caption of the label. - * - * @return The caption of the label. - * @see setCaption - */ - const std::string &getCaption() const; - - /** - * Sets the caption of the label. It's advisable to call - * adjustSize after setting of the caption to adjust the - * label's size to fit the caption. - * - * @param caption The caption of the label. - * @see getCaption, adjustSize - */ - void setCaption(const std::string& caption); - - /** - * Sets the alignment for the caption. The alignment is relative - * to the center of the label. - * - * @param alignemnt Graphics::LEFT, Graphics::CENTER or Graphics::RIGHT. - * @see getAlignment, Graphics - */ - void setAlignment(unsigned int alignment); - - /** - * Gets the alignment for the caption. The alignment is relative to - * the center of the label. - * - * @return alignment of caption. Graphics::LEFT, Graphics::CENTER or Graphics::RIGHT. - * @see setAlignmentm Graphics - */ - unsigned int getAlignment() const; - - /** - * Adjusts the label's size to fit the caption size. - */ - void adjustSize(); - - - // Inherited from Widget - - virtual void draw(Graphics* graphics); - - virtual void drawBorder(Graphics* graphics); - - protected: - /** - * Holds the caption of the label. - */ - std::string mCaption; - - /** - * Holds the alignment of the caption. - */ - unsigned int mAlignment; - }; -} - -#endif // end GCN_LABEL_HPP diff --git a/src/include/guisan/widgets/listbox.hpp b/src/include/guisan/widgets/listbox.hpp deleted file mode 100644 index fc0e0f0b..00000000 --- a/src/include/guisan/widgets/listbox.hpp +++ /dev/null @@ -1,254 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/keylistener.hpp" -#include "guisan/listmodel.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" - -namespace gcn -{ - class SelectionListener; - - /** - * An implementation of a list box where an item can be selected. - * - * To be able display a list the list box uses a user provided list model. - * A list model can be any class that implements the ListModel interface. - * - * If an item is selected in the list box a select event will be sent to all selection - * listeners of the list box. If an item is selected by using a mouse click or by using - * the enter or space key an action event will be sent to all action listeners of the - * list box. - */ - class GCN_CORE_DECLSPEC ListBox : - public Widget, - public MouseListener, - public KeyListener - { - public: - /** - * Constructor. - */ - ListBox(); - - /** - * Constructor. - * - * @param listModel the list model to use. - */ - ListBox(ListModel *listModel); - - /** - * Destructor. - */ - virtual ~ListBox() { } - - /** - * Gets the selected item as an index in the list model. - * - * @return the selected item as an index in the list model. - * @see setSelected - */ - int getSelected() const; - - /** - * Sets the selected item. The selected item is represented by - * an index from the list model. - * - * @param selected the selected item as an index from the list model. - * @see getSelected - */ - void setSelected(int selected); - - /** - * Sets the list model to use. - * - * @param listModel the list model to use. - * @see getListModel - */ - void setListModel(ListModel *listModel); - - /** - * Gets the list model used. - * - * @return the list model used. - * @see setListModel - */ - ListModel *getListModel(); - - /** - * Adjusts the size of the list box to fit it's list model. - */ - void adjustSize(); - - /** - * Checks whether the list box wraps when selecting items with a keyboard. - * - * Wrapping means that the selection of items will be wrapped. That is, if - * the first item is selected and up is pressed, the last item will get - * selected. If the last item is selected and down is pressed, the first item - * will get selected. - * - * @return true if wrapping is enabled, fasle otherwise. - * @see setWrappingEnabled - */ - bool isWrappingEnabled() const; - - /** - * Sets the list box to wrap or not when selecting items with a keyboard. - * - * Wrapping means that the selection of items will be wrapped. That is, if - * the first item is selected and up is pressed, the last item will get - * selected. If the last item is selected and down is pressed, the first item - * will get selected. - * - * @see isWrappingEnabled - */ - void setWrappingEnabled(bool wrappingEnabled); - - /** - * Adds a selection listener to the list box. When the selection - * changes an event will be sent to all selection listeners of the - * list box. - * - * @param selectionListener The selection listener to add. - * @since 0.8.0 - */ - void addSelectionListener(SelectionListener* selectionListener); - - /** - * Removes a selection listener from the list box. - * - * @param selectionListener The selection listener to remove. - * @since 0.8.0 - */ - void removeSelectionListener(SelectionListener* selectionListener); - - - // Inherited from Widget - - virtual void draw(Graphics* graphics); - - virtual void drawBorder(Graphics* graphics); - - virtual void logic(); - - - // Inherited from KeyListener - - virtual void keyPressed(KeyEvent& keyEvent); - - - // Inherited from MouseListener - - virtual void mousePressed(MouseEvent& mouseEvent); - - virtual void mouseWheelMovedUp(MouseEvent& mouseEvent); - - virtual void mouseWheelMovedDown(MouseEvent& mouseEvent); - - virtual void mouseDragged(MouseEvent& mouseEvent); - - - protected: - /** - * Distributes a value changed event to all selection listeners - * of the list box. - * - * @since 0.8.0 - */ - void distributeValueChangedEvent(); - - /** - * The list model to use. - */ - ListModel *mListModel; - - /** - * The selected item as an index in the list model. - */ - int mSelected; - - /** - * True if wrapping is enabled, false otherwise. - */ - bool mWrappingEnabled; - - /** - * Typdef. - */ - typedef std::list SelectionListenerList; - - /** - * The selection listeners of the list box. - */ - SelectionListenerList mSelectionListeners; - - /** - * Typedef. - */ - typedef SelectionListenerList::iterator SelectionListenerIterator; - }; -} - -#endif // end GCN_LISTBOX_HPP diff --git a/src/include/guisan/widgets/radiobutton.hpp b/src/include/guisan/widgets/radiobutton.hpp deleted file mode 100644 index 0b1e0aca..00000000 --- a/src/include/guisan/widgets/radiobutton.hpp +++ /dev/null @@ -1,225 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include - -#include "guisan/keylistener.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" - -namespace gcn -{ - /** - * Implementation of a radio button where a user can select or deselect - * the radio button and where the status of the radio button is displayed to the user. - * A radio button can belong to a group and when a radio button belongs to a - * group only one radio button can be selected in the group. A radio button is - * capable of displaying a caption. - * - * If a radio button's state changes an action event will be sent to all action - * listeners of the check box. - */ - class GCN_CORE_DECLSPEC RadioButton : - public Widget, - public MouseListener, - public KeyListener - { - public: - - /** - * Constructor. - */ - RadioButton(); - - /** - * Constructor. - * - * @param caption The caption of the radio button. - * @param group The group the radio button should belong to. - * @param selected True if the radio button should be selected. - */ - RadioButton(const std::string &caption, - const std::string &group, - bool selected = false); - - /** - * Destructor. - */ - virtual ~RadioButton(); - - /** - * Checks if the radio button is selected. - * - * @return True if the radio button is selecte, false otherwise. - * @see setSelected - */ - bool isSelected() const; - - /** - * Sets the radio button to selected or not. - * - * @param selected True if the radio button should be selected, - * false otherwise. - * @see isSelected - */ - void setSelected(bool selected); - - /** - * Gets the caption of the radio button. - * - * @return The caption of the radio button. - * @see setCaption - */ - const std::string &getCaption() const; - - /** - * Sets the caption of the radio button. It's advisable to call - * adjustSize after setting of the caption to adjust the - * radio button's size to fit the caption. - * - * @param caption The caption of the radio button. - * @see getCaption, adjustSize - */ - void setCaption(const std::string caption); - - /** - * Sets the group the radio button should belong to. Note that - * a radio button group is unique per application, not per Gui object - * as the group is stored in a static map. - * - * @param group The name of the group. - * @see getGroup - */ - void setGroup(const std::string &group); - - /** - * Gets the group the radio button belongs to. - * - * @return The group the radio button belongs to. - * @see setGroup - */ - const std::string &getGroup() const; - - /** - * Adjusts the radio button's size to fit the caption. - */ - void adjustSize(); - - - // Inherited from Widget - - virtual void draw(Graphics* graphics); - - virtual void drawBorder(Graphics* graphics); - - - // Inherited from KeyListener - - virtual void keyPressed(KeyEvent& keyEvent); - - - // Inherited from MouseListener - - virtual void mouseClicked(MouseEvent& mouseEvent); - - virtual void mouseDragged(MouseEvent& mouseEvent); - - protected: - /** - * Draws the box. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawBox(Graphics *graphics); - - /** - * True if the radio button is selected, false otherwise. - */ - bool mSelected; - - /** - * Holds the caption of the radio button. - */ - std::string mCaption; - - /** - * Holds the group of the radio button. - */ - std::string mGroup; - - /** - * Typdef. - */ - typedef std::multimap GroupMap; - - /** - * Typdef. - */ - typedef GroupMap::iterator GroupIterator; - - /** - * Holds all available radio button groups. - */ - static GroupMap mGroupMap; - }; -} - -#endif // end GCN_RADIOBUTTON_HPP diff --git a/src/include/guisan/widgets/scrollarea.hpp b/src/include/guisan/widgets/scrollarea.hpp deleted file mode 100644 index 6a723ea8..00000000 --- a/src/include/guisan/widgets/scrollarea.hpp +++ /dev/null @@ -1,488 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/basiccontainer.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - /** - * A ScrollArea in which another Widget can be added. It the other Widget - * is bigger then the ScrollArea, the ScrollArea will only display the part - * of the Widget that fits the ScrollArea and make it possible to scroll - * to the other areas of the Widget. - * - * NOTE: A TextBox or a ListBox looks really ugly unless they exist in a - * ScrollArea. - */ - class GCN_CORE_DECLSPEC ScrollArea: - public BasicContainer, - public MouseListener - { - public: - - /** - * Constructor. - */ - ScrollArea(); - - /** - * Constructor. - * - * @param content the content of the ScrollArea. - */ - ScrollArea(Widget *content); - - /** - * Constructor. - * - * @param content the content of the ScrollArea. - * @param hPolicy the policy for the horizontal scrollbar. See enum with - * policies. - * @param vPolicy the policy for the vertical scrollbar. See enum with - * policies. - */ - ScrollArea(Widget *content, unsigned int hPolicy, unsigned int vPolicy); - - /** - * Destructor. - */ - virtual ~ScrollArea(); - - /** - * Sets the content. - * - * @param widget the content of the ScrollArea. - */ - void setContent(Widget* widget); - - /** - * Gets the content. - * - * @return the content of the ScrollArea. - */ - Widget* getContent(); - - /** - * Sets the horizontal scrollbar policy. See enum with policies. - * - * @param hPolicy the policy for the horizontal scrollbar. See enum with - * policies. - */ - void setHorizontalScrollPolicy(unsigned int hPolicy); - - /** - * Gets the horizontal scrollbar policy. See enum with policies. - * - * @return the policy for the horizontal scrollbar policy. See enum with - * policies. - */ - unsigned int getHorizontalScrollPolicy() const; - - /** - * Sets the vertical scrollbar policy. See enum with policies. - * - * @param vPolicy the policy for the vertical scrollbar. See enum with - * policies. - */ - void setVerticalScrollPolicy(unsigned int vPolicy); - - /** - * Gets the vertical scrollbar policy. See enum with policies. - * - * @return the policy for the vertical scrollbar. See enum with - * policies. - */ - unsigned int getVerticalScrollPolicy() const; - - /** - * Sets the horizontal and vertical scrollbar policy. See enum with policies. - * - * @param hPolicy the policy for the horizontal scrollbar. See enum with - * policies. - * @param vPolicy the policy for the vertical scrollbar. See enum with - * policies. - */ - void setScrollPolicy(unsigned int hPolicy, unsigned int vPolicy); - - /** - * Sets the amount to scroll vertically. - * - * @param vScroll the amount to scroll. - */ - void setVerticalScrollAmount(int vScroll); - - /** - * Gets the amount that is scrolled vertically. - * @return the scroll amount on vertical scroll. - */ - int getVerticalScrollAmount() const; - - /** - * Sets the amount to scroll horizontally. - * - * @param hScroll the amount to scroll. - */ - void setHorizontalScrollAmount(int hScroll); - - /** - * Gets the amount that is scrolled horizontally. - * - * @return the scroll amount on horizontal scroll. - */ - int getHorizontalScrollAmount() const; - - /** - * Sets the amount to scroll horizontally and vertically. - * - * @param hScroll the amount to scroll on horizontal scroll. - * @param vScroll the amount to scroll on vertical scroll. - */ - void setScrollAmount(int hScroll, int vScroll); - - /** - * Gets the maximum amount of horizontal scroll. - * - * @return the horizontal max scroll. - */ - int getHorizontalMaxScroll(); - - /** - * Gets the maximum amount of vertical scroll. - * - * @return the vertical max scroll. - */ - int getVerticalMaxScroll(); - - /** - * Sets the width. - * - * @param width the width of the ScrollBar. - */ - void setScrollbarWidth(int width); - - /** - * Gets the width. - - * @return the width of the ScrollBar. - */ - int getScrollbarWidth() const; - - /** - * Sets the amount to scroll in pixels when the left scroll button is - * pushed. - */ - void setLeftButtonScrollAmount(int amount); - - /** - * Sets the amount to scroll in pixels when the right scroll button is - * pushed. - */ - void setRightButtonScrollAmount(int amount); - - /** - * Sets the amount to scroll in pixels when the up scroll button is - * pushed. - */ - void setUpButtonScrollAmount(int amount); - - /** - * Sets the amount to scroll in pixels when the down scroll button is - * pushed. - */ - void setDownButtonScrollAmount(int amount); - - /** - * Gets the amount to scroll in pixels when the left scroll button is - * pushed. - * - * @return the amount to scroll when the left scroll button is pushed. - */ - int getLeftButtonScrollAmount() const; - - /** - * Gets the amount to scroll in pixels when the right scroll button is - * pushed. - * - * @return the amount to scroll when the right scroll button is pushed. - */ - int getRightButtonScrollAmount() const; - - /** - * Gets the amount to scroll in pixels when the up scroll button is - * pushed. - * - * @return the amount to scroll when the up scroll button is pushed. - */ - int getUpButtonScrollAmount() const; - - /** - * Gets the amount to scroll in pixels when the down scroll button is - * pushed. - * - * @return the amount to scroll when the down scroll button is pushed. - */ - int getDownButtonScrollAmount() const; - - - // Inherited from BasicContainer - - virtual void showWidgetPart(Widget* widget, Rectangle area); - - virtual Rectangle getChildrenArea(); - - virtual Widget *getWidgetAt(int x, int y); - - - // Inherited from Widget - - virtual void draw(Graphics *graphics); - - virtual void drawBorder(Graphics* graphics); - - virtual void logic(); - - void setWidth(int width); - - void setHeight(int height); - - void setDimension(const Rectangle& dimension); - - - // Inherited from MouseListener - - virtual void mousePressed(MouseEvent& mouseEvent); - - virtual void mouseReleased(MouseEvent& mouseEvent); - - virtual void mouseDragged(MouseEvent& mouseEvent); - - virtual void mouseWheelMovedUp(MouseEvent& mouseEvent); - - virtual void mouseWheelMovedDown(MouseEvent& mouseEvent); - - - /** - * Scrollpolicies for the horizontal and vertical scrollbar. - * The policies are: - * - * SHOW_ALWAYS - Always show the scrollbars no matter what. - * SHOW_NEVER - Never show the scrollbars no matter waht. - * SHOW_AUTO - Show the scrollbars only when needed. That is if the - * content grows larger then the ScrollArea. - */ - enum - { - SHOW_ALWAYS, - SHOW_NEVER, - SHOW_AUTO - }; - - protected: - /** - * Draws the background of the ScrollArea - * (the area behind the content). - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawBackground(Graphics *graphics); - - /** - * Draws the up button. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawUpButton(Graphics *graphics); - - /** - * Draws the down button. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawDownButton(Graphics *graphics); - - /** - * Draws the left button. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawLeftButton(Graphics *graphics); - - /** - * Draws the right button. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawRightButton(Graphics *graphics); - - /** - * Draws the vertical scrollbar. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawVBar(Graphics* graphics); - - /** - * Draws the horizontal scrollbar. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawHBar(Graphics* graphics); - - /** - * Draws the vertical marker. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawVMarker(Graphics* graphics); - - /** - * Draws the horizontal marker. - * - * @param graphics a Graphics object to draw with. - */ - virtual void drawHMarker(Graphics* graphics); - - /** - * Checks the policies for the scrollbars. - */ - virtual void checkPolicies(); - - /** - * Gets the up button dimension. - * - * @return the dimension of the up button. - */ - Rectangle getUpButtonDimension(); - - /** - * Gets the down button dimension. - * - * @return the dimension of the down button. - */ - Rectangle getDownButtonDimension(); - - /** - * Gets the left button dimension. - * - * @return the dimension of the left button. - */ - Rectangle getLeftButtonDimension(); - - /** - * Gets the right button dimension. - * - * @return the dimension of the right button. - */ - Rectangle getRightButtonDimension(); - - /** - * Gets the vertical scrollbar dimension. - * - * @return the dimension of the vertical scrollbar. - */ - Rectangle getVerticalBarDimension(); - - /** - * Gets the horizontal scrollbar dimension. - * - * @return the dimension of the horizontal scrollbar. - */ - Rectangle getHorizontalBarDimension(); - - /** - * Gets the vertical marker dimension. - * - * @return the dimension of the vertical marker. - */ - Rectangle getVerticalMarkerDimension(); - - /** - * Gets the horizontal marker dimension. - * - * @return the dimension of the horizontal marker. - */ - Rectangle getHorizontalMarkerDimension(); - - int mVScroll; - int mHScroll; - int mScrollbarWidth; - unsigned int mHPolicy; - unsigned int mVPolicy; - bool mVBarVisible; - bool mHBarVisible; - bool mUpButtonPressed; - bool mDownButtonPressed; - bool mLeftButtonPressed; - bool mRightButtonPressed; - int mUpButtonScrollAmount; - int mDownButtonScrollAmount; - int mLeftButtonScrollAmount; - int mRightButtonScrollAmount; - bool mIsVerticalMarkerDragged; - bool mIsHorizontalMarkerDragged; - int mHorizontalMarkerDragOffset; - int mVerticalMarkerDragOffset; - }; -} - -#endif // end GCN_SCROLLAREA_HPP diff --git a/src/include/guisan/widgets/slider.hpp b/src/include/guisan/widgets/slider.hpp deleted file mode 100644 index 99656147..00000000 --- a/src/include/guisan/widgets/slider.hpp +++ /dev/null @@ -1,267 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include - -#include "guisan/basiccontainer.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - class Label; - class TabbedArea; - - /** - * A simple tab widget used as the default tab in the TabbedArea widget. - */ - class GCN_CORE_DECLSPEC Tab: - public BasicContainer, - public MouseListener - { - public: - - /** - * Constructor. - */ - Tab(); - - /** - * Destructor. - */ - virtual ~Tab(); - - /** - * Adjusts the tab size to fit the label. - */ - void adjustSize(); - - /** - * Sets the tabbed area the tab should be a part of. - * - * @param tabbedArea The tabbed area the tab should be a part of. - */ - void setTabbedArea(TabbedArea* tabbedArea); - - /** - * Gets the tabbed are the tab is a part of. - * - * @return The tabbed are the tab is a part of. - */ - TabbedArea* getTabbedArea(); - - /** - * Sets the caption of the tab. - * - * @param caption The caption of the tab. - */ - void setCaption(const std::string& caption); - - /** - * Gets the caption of the tab. - * - * @return The caption of the tab. - */ - const std::string& getCaption() const; - - - // Inherited from Widget - - virtual void draw(Graphics *graphics); - - virtual void drawBorder(Graphics* graphics); - - - // Inherited from MouseListener - - virtual void mouseEntered(MouseEvent& mouseEvent); - - virtual void mouseExited(MouseEvent& mouseEvent); - - protected: - Label* mLabel; - TabbedArea* mTabbedArea; - std::string mCaption; - bool mHasMouse; - }; -} - -#endif // end GCN_TABBEDAREA_HPP diff --git a/src/include/guisan/widgets/tabbedarea.hpp b/src/include/guisan/widgets/tabbedarea.hpp deleted file mode 100644 index d85498ed..00000000 --- a/src/include/guisan/widgets/tabbedarea.hpp +++ /dev/null @@ -1,226 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include -#include - -#include "guisan/actionlistener.hpp" -#include "guisan/basiccontainer.hpp" -#include "guisan/keylistener.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" - -namespace gcn -{ - class Container; - class Tab; - - /** - * With the tabbed area widget several widgets can share the same - * space. The widget to view is selected by the user by using tabs. - */ - class GCN_CORE_DECLSPEC TabbedArea: - public ActionListener, - public BasicContainer, - public KeyListener, - public MouseListener - { - public: - - /** - * Constructor. - */ - TabbedArea(); - - /** - * Destructor. - */ - virtual ~TabbedArea(); - - /** - * Adds a tab to the tabbed area. - * - * @param caption The caption of the tab. - * @param widget The widget to view when the tab is selected. - */ - virtual void addTab(const std::string& caption, Widget* widget); - - /** - * Adds a tab to the tabbed area. - * - * @param tab The tab widget for the tab. - * @param widget The widget to view when the tab is selected. - */ - virtual void addTab(Tab* tab, Widget* widget); - - /** - * Removes a tab from the tabbed area. - * - * @param index The index of the tab to remove. - */ - virtual void removeTabWithIndex(unsigned int index); - - /** - * Removes a tab from the tabbed area. - * - * @param index The tab to remove. - */ - virtual void removeTab(Tab* tab); - - /** - * Checks whether a tab given an index is selected. - * - * @param index The index of the tab to check. - * @return True if the tab is selected, false otherwise. - */ - virtual bool isTabSelected(unsigned int index) const; - - /** - * Checks whether a tab is selected or not. - * - * @param index The tab to check. - * @return True if the tab is selected, false otherwise. - */ - virtual bool isTabSelected(Tab* tab); - - /** - * Sets a tab given an index to be selected. - * - * @param index The index of the tab to be selected. - */ - virtual void setSelectedTabWithIndex(unsigned int index); - - /** - * Sets a tab to be selected or not. - * - * @param index The tab to be selected. - */ - virtual void setSelectedTab(Tab* tab); - - /** - * Gets the index of the selected tab. - * - * @return The undex of the selected tab. - * If no tab is selected -1 will be returned. - */ - virtual int getSelectedTabIndex() const; - - /** - * Gets the selected tab. - * - * @return The selected tab. - */ - Tab* getSelectedTab(); - - - // Inherited from Widget - - virtual void draw(Graphics *graphics); - - virtual void drawBorder(Graphics* graphics); - - virtual void logic(); - - void setWidth(int width); - - void setHeight(int height); - - void setSize(int width, int height); - - void setDimension(const Rectangle& dimension); - - - // Inherited from ActionListener - - void action(const ActionEvent& actionEvent); - - - // Inherited from DeathListener - - virtual void death(const Event& event); - - - // Inherited from KeyListener - - virtual void keyPressed(KeyEvent& keyEvent); - - - // Inherited from MouseListener - - virtual void mousePressed(MouseEvent& mouseEvent); - - - protected: - /** - * Adjusts the size of the tabbed area. - */ - void adjustSize(); - void adjustTabPositions(); - - Tab* mSelectedTab; - Container* mTabContainer; - Container* mWidgetContainer; - std::vector mTabsToCleanUp; - std::vector > mTabs; - - }; -} - -#endif // end GCN_TABBEDAREA_HPP diff --git a/src/include/guisan/widgets/textbox.hpp b/src/include/guisan/widgets/textbox.hpp deleted file mode 100644 index 5a4b5bfc..00000000 --- a/src/include/guisan/widgets/textbox.hpp +++ /dev/null @@ -1,264 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include -#include - -#include "guisan/keylistener.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" - -namespace gcn -{ - /** - * A TextBox in which you can write and/or display a lines of text. - * - * NOTE: A plain TextBox is really uggly and looks much better inside a - * ScrollArea. - */ - class GCN_CORE_DECLSPEC TextBox: - public Widget, - public MouseListener, - public KeyListener - { - public: - /** - * Constructor. - */ - TextBox(); - - /** - * Constructor. - * - * @param text the text of the TextBox. - */ - TextBox(const std::string& text); - - /** - * Sets the text. - * - * @param text the text of the TextBox. - */ - void setText(const std::string& text); - - /** - * Gets the text. - * @return the text of the TextBox. - */ - std::string getText() const; - - /** - * Gets the row of a text. - * - * @return the text of a certain row in the TextBox. - */ - const std::string& getTextRow(int row) const; - - /** - * Sets the text of a certain row in a TextBox. - * - * @param row the row number. - * @param text the text of a certain row in the TextBox. - */ - void setTextRow(int row, const std::string& text); - - /** - * Gets the number of rows in the text. - * - * @return the number of rows in the text. - */ - unsigned int getNumberOfRows() const; - - /** - * Gets the caret position in the text. - * - * @return the caret position in the text. - */ - unsigned int getCaretPosition() const; - - /** - * Sets the position of the caret in the text. - * - * @param position the positon of the caret. - */ - void setCaretPosition(unsigned int position); - - /** - * Gets the row the caret is in in the text. - * - * @return the row the caret is in in the text. - */ - unsigned int getCaretRow() const; - - /** - * Sets the row the caret should be in in the text. - * - * @param row the row number. - */ - void setCaretRow(int row); - - /** - * Gets the column the caret is in in the text. - * - * @return the column the caret is in in the text. - */ - unsigned int getCaretColumn() const; - - /** - * Sets the column the caret should be in in the text. - * - * @param column the column number. - */ - void setCaretColumn(int column); - - /** - * Sets the row and the column the caret should be in in the text. - * - * @param row the row number. - * @param column the column number. - */ - void setCaretRowColumn(int row, int column); - - /** - * Scrolls the text to the caret if the TextBox is in a ScrollArea. - */ - virtual void scrollToCaret(); - - /** - * Checks if the TextBox is editable. - * - * @return true it the TextBox is editable. - */ - bool isEditable() const; - - /** - * Sets if the TextBox should be editable or not. - * - * @param editable true if the TextBox should be editable. - */ - void setEditable(bool editable); - - /** - * Adds a text row to the text. - * - * @param row a row. - */ - virtual void addRow(const std::string row); - - /** - * Checks if the TextBox is opaque - * - * @return true if the TextBox is opaque - */ - bool isOpaque(); - - /** - * Sets the TextBox to be opaque. - * - * @param opaque true if the TextBox should be opaque. - */ - void setOpaque(bool opaque); - - - // Inherited from Widget - - virtual void draw(Graphics* graphics); - - virtual void drawBorder(Graphics* graphics); - - virtual void fontChanged(); - - - // Inherited from KeyListener - - virtual void keyPressed(KeyEvent& keyEvent); - - - // Inherited from MouseListener - - virtual void mousePressed(MouseEvent& mouseEvent); - - virtual void mouseDragged(MouseEvent& mouseEvent); - - protected: - /** - * Draws the caret. - * - * @param graphics a Graphics object to draw with. - * @param x the x position. - * @param y the y position. - */ - virtual void drawCaret(Graphics* graphics, int x, int y); - - /** - * Adjusts the TextBox size to fit the font size. - */ - virtual void adjustSize(); - - std::vector mTextRows; - int mCaretColumn; - int mCaretRow; - bool mEditable; - bool mOpaque; - }; -} - -#endif // end GCN_TEXTBOX_HPP diff --git a/src/include/guisan/widgets/textfield.hpp b/src/include/guisan/widgets/textfield.hpp deleted file mode 100644 index b6c1061e..00000000 --- a/src/include/guisan/widgets/textfield.hpp +++ /dev/null @@ -1,175 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -namespace gcn -{ - /** - * A text field in which you can write or display a line of text. - */ - class GCN_CORE_DECLSPEC TextField: - public Widget, - public MouseListener, - public KeyListener - { - public: - /** - * Default constructor. - */ - TextField(); - - /** - * Constructor. Initializes the textfield with a given string. - * - * @param text the initial text. - */ - TextField(const std::string& text); - - /** - * Sets the text. - * - * @param text the new text in the TextField. - */ - void setText(const std::string& text); - - /** - * Gets the text. - * - * @return the text of the TextField. - */ - const std::string& getText() const; - - /** - * Draws the caret (the little marker in the text that shows where the - * letters you type will appear). Easily overloaded if you want to - * change the style of the caret. - * - * @param graphics the Graphics object to draw with. - * @param x the caret's x-position. - */ - virtual void drawCaret(Graphics* graphics, int x); - - /** - * Adjusts the size of the TextField to fit the font size. The - * constructor taking a string uses this function to initialize the - * size of the TextField. - */ - void adjustSize(); - - /** - * Adjusts the height of the text field to fit the font size. The - * height of the TextField is initialized with this function by the - * constructors. - */ - void adjustHeight(); - - /** - * Sets the caret position. - * - * @param position the caret position. - */ - void setCaretPosition(unsigned int position); - - /** - * Gets the caret position. - * - * @return the caret position. - */ - unsigned int getCaretPosition() const; - - - // Inherited from Widget - - virtual void fontChanged(); - - virtual void draw(Graphics* graphics); - - virtual void drawBorder(Graphics* graphics); - - - // Inherited from MouseListener - - virtual void mousePressed(MouseEvent& mouseEvent); - - virtual void mouseDragged(MouseEvent& mouseEvent); - - - // Inherited from KeyListener - - virtual void keyPressed(KeyEvent& keyEvent); - - protected: - /** - * Scrolls the text horizontally so that the caret shows if needed. - */ - void fixScroll(); - - std::string mText; - unsigned int mCaretPosition; - int mXScroll; - }; -} - -#endif // end GCN_TEXTFIELD_HPP diff --git a/src/include/guisan/widgets/window.hpp b/src/include/guisan/widgets/window.hpp deleted file mode 100644 index 72b35fd9..00000000 --- a/src/include/guisan/widgets/window.hpp +++ /dev/null @@ -1,217 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u - -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widgets/container.hpp" - -namespace gcn -{ - /** - * A movable window which can contain another Widgets. - */ - class GCN_CORE_DECLSPEC Window : public Container, - public MouseListener - { - public: - /** - * Constructor. - */ - Window(); - - /** - * Constructor. - * - * @param caption the Window caption. - */ - Window(const std::string& caption); - - /** - * Destructor. - */ - virtual ~Window(); - - /** - * Sets the Window caption. - * - * @param caption the Window caption. - */ - void setCaption(const std::string& caption); - - /** - * Gets the Window caption. - * - * @return the Window caption. - */ - const std::string& getCaption() const; - - /** - * Sets the alignment for the caption. - * - * @param alignment Graphics::LEFT, Graphics::CENTER or Graphics::RIGHT. - */ - void setAlignment(unsigned int alignment); - - /** - * Gets the alignment for the caption. - * - * @return alignment of caption. - */ - unsigned int getAlignment() const; - - /** - * Sets the padding of the window which is the distance between the - * window border and the content. - * - * @param padding the padding value. - */ - void setPadding(unsigned int padding); - - /** - * Gets the padding. - * - * @return the padding value. - */ - unsigned int getPadding() const; - - /** - * Sets the title bar height. - * - * @param height the title height value. - */ - void setTitleBarHeight(unsigned int height); - - /** - * Gets the title bar height. - * - * @return the title bar height. - */ - unsigned int getTitleBarHeight(); - - /** - * Sets the Window to be moveble. - * - * @param movable true or false. - */ - void setMovable(bool movable); - - /** - * Check if the window is movable. - * - * @return true or false. - */ - bool isMovable() const; - - /** - * Sets the Window to be opaque. If it's not opaque, the content area - * will not be filled with a color. - * - * @param opaque true or false. - */ - void setOpaque(bool opaque); - - /** - * Checks if the Window is opaque. - * - * @return true or false. - */ - bool isOpaque(); - - /** - * Resizes the container to fit the content exactly. - */ - virtual void resizeToContent(); - - - // Inherited from BasicContainer - - virtual Rectangle getChildrenArea(); - - - // Inherited from Widget - - virtual void draw(Graphics* graphics); - - virtual void drawBorder(Graphics* graphics); - - - // Inherited from MouseListener - - virtual void mousePressed(MouseEvent& mouseEvent); - - virtual void mouseDragged(MouseEvent& mouseEvent); - - virtual void mouseReleased(MouseEvent& mouseEvent); - - protected: - std::string mCaption; - unsigned int mAlignment; - unsigned int mPadding; - unsigned int mTitleBarHeight; - bool mMovable; - bool mOpaque; - int mDragOffsetX; - int mDragOffsetY; - bool mIsMoving; - }; -} - -#endif // end GCN_WINDOW_HPP diff --git a/src/include/guisan/x.hpp b/src/include/guisan/x.hpp deleted file mode 100644 index 6a372168..00000000 --- a/src/include/guisan/x.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson - * - * Js_./ - * Per Larsson a.k.a finalman _RqZ{a<^_aa - * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// - * _Qhm`] _f "'c 1!5m - * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' - * binary forms, with or without )4d[#7r, . ' )d`)[ - * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' - * that the following conditions are met: j<. a J@\ - * this list of conditions and the j(]1u -#include - -#endif // end GCN_X_HPP diff --git a/src/main.cpp b/src/main.cpp index f7343832..40496292 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,14 +42,14 @@ #endif #ifdef USE_SDL -#include -#include -//#include "gui_handling.h" -#include "pandora_gfx.h" -SDL_Window* sdlWindow; -SDL_Renderer* renderer; -SDL_Texture *texture; +#include "SDL.h" #endif +#ifdef CAPSLOCK_DEBIAN_WORKAROUND + #include + #include + #include "keyboard.h" +#endif + long int version = 256*65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV; struct uae_prefs currprefs, changed_prefs; @@ -426,7 +426,7 @@ void print_usage() printf("File names should be with absolute path.\n"); printf("\nExample:\n"); printf("uae4arm -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no\n"); - printf("It will load A500.uae configuration with the save state named game.\n"); + printf("It will load A400.uae configuration with the save state named game.\n"); printf("It will override use_gui to 'no' so that it enters emulation directly.\n"); exit(1); } @@ -597,6 +597,16 @@ void do_leave_program (void) void start_program (void) { + #ifdef CAPSLOCK_DEBIAN_WORKAROUND + char kbd_flags; + // set capslock state based upon current "real" state + ioctl(0, KDGKBLED, &kbd_flags); + if ((kbd_flags & 07) & LED_CAP) + { + // record capslock pressed + inputdevice_do_keyboard(AK_CAPSLOCK, 1); + } + #endif do_start_program (); } @@ -627,46 +637,17 @@ void virtualdevice_init (void) #endif } -// In case of error, print the error code and close the application -void check_error_sdl(bool check, const char* message) { - if (check) { - std::cout << message << " " << SDL_GetError() << std::endl; - SDL_Quit(); - std::exit(-1); - } -} - static int real_main2 (int argc, TCHAR **argv) { printf("Amiberry v2.0 build 2016-10-01.1\n"); +#ifdef PANDORA_SPECIFIC + SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_VIDEO); +#else +#ifdef USE_SDL + SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK); +#endif +#endif - //Initialize SDL - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0) - { - printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); - } - - sdlWindow = SDL_CreateWindow("Amiberry v2", - SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, - 0, - 0, - SDL_WINDOW_FULLSCREEN_DESKTOP); - check_error_sdl(sdlWindow == nullptr, "Unable to create window"); - - renderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); - check_error_sdl(renderer == nullptr, "Unable to create a renderer"); - - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother. - SDL_RenderSetLogicalSize(renderer, 800, 480); - - texture = SDL_CreateTexture(renderer, - SDL_PIXELFORMAT_ARGB8888, - SDL_TEXTUREACCESS_STREAMING, - 800, - 480); - check_error_sdl(texture == nullptr, "Unable to create texture"); - keyboard_settrans(); if (restart_config[0]) diff --git a/src/od-pandora/gui/CreateFilesysHardfile.cpp b/src/od-pandora/gui/CreateFilesysHardfile.cpp index 4476886d..d73a80fe 100644 --- a/src/od-pandora/gui/CreateFilesysHardfile.cpp +++ b/src/od-pandora/gui/CreateFilesysHardfile.cpp @@ -1,8 +1,7 @@ -#include -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -18,7 +17,7 @@ #include "filesys.h" #include "gui.h" #include "gui_handling.h" -#include "pandora_gfx.h" + #define DIALOG_WIDTH 620 #define DIALOG_HEIGHT 202 @@ -228,6 +227,13 @@ static void CreateFilesysHardfileLoop(void) if(HandleNavigation(DIRECTION_RIGHT)) continue; // Don't change value when enter Slider -> don't send event to control break; + + case SDLK_PAGEDOWN: + case SDLK_HOME: + event.key.keysym.sym = SDLK_RETURN; + gui_input->pushInput(event); // Fire key down + event.type = SDL_KEYUP; // and the key up + break; } } @@ -241,12 +247,9 @@ static void CreateFilesysHardfileLoop(void) uae_gui->logic(); // Now we let the Gui object draw itself. uae_gui->draw(); - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); + // Finally we update the screen. + wait_for_vsync(); + SDL_Flip(gui_screen); } } diff --git a/src/od-pandora/gui/EditFilesysHardfile.cpp b/src/od-pandora/gui/EditFilesysHardfile.cpp index 29cbf8bc..28be7dc2 100644 --- a/src/od-pandora/gui/EditFilesysHardfile.cpp +++ b/src/od-pandora/gui/EditFilesysHardfile.cpp @@ -1,7 +1,7 @@ -#include -#include +#include +#include #include -#include "guisan/sdl/sdltruetypefont.hpp" +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -17,7 +17,7 @@ #include "filesys.h" #include "gui.h" #include "gui_handling.h" -#include "pandora_gfx.h" + #define DIALOG_WIDTH 620 #define DIALOG_HEIGHT 242 @@ -293,6 +293,13 @@ static void EditFilesysHardfileLoop(void) if(HandleNavigation(DIRECTION_RIGHT)) continue; // Don't change value when enter Slider -> don't send event to control break; + + case SDLK_PAGEDOWN: + case SDLK_HOME: + event.key.keysym.sym = SDLK_RETURN; + gui_input->pushInput(event); // Fire key down + event.type = SDL_KEYUP; // and the key up + break; } } @@ -306,12 +313,9 @@ static void EditFilesysHardfileLoop(void) uae_gui->logic(); // Now we let the Gui object draw itself. uae_gui->draw(); - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); + // Finally we update the screen. + wait_for_vsync(); + SDL_Flip(gui_screen); } } diff --git a/src/od-pandora/gui/EditFilesysVirtual.cpp b/src/od-pandora/gui/EditFilesysVirtual.cpp index e7844330..32d5208a 100644 --- a/src/od-pandora/gui/EditFilesysVirtual.cpp +++ b/src/od-pandora/gui/EditFilesysVirtual.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -17,7 +17,7 @@ #include "filesys.h" #include "gui.h" #include "gui_handling.h" -#include "pandora_gfx.h" + #define DIALOG_WIDTH 520 #define DIALOG_HEIGHT 202 @@ -233,6 +233,13 @@ static void EditFilesysVirtualLoop(void) if (HandleNavigation(DIRECTION_RIGHT)) continue; // Don't change value when enter Slider -> don't send event to control break; + + case SDLK_PAGEDOWN: + case SDLK_HOME: + event.key.keysym.sym = SDLK_RETURN; + gui_input->pushInput(event); // Fire key down + event.type = SDL_KEYUP; // and the key up + break; } } @@ -246,12 +253,9 @@ static void EditFilesysVirtualLoop(void) uae_gui->logic(); // Now we let the Gui object draw itself. uae_gui->draw(); - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); + // Finally we update the screen. + wait_for_vsync(); + SDL_Flip(gui_screen); } } diff --git a/src/od-pandora/gui/InGameMessage.cpp b/src/od-pandora/gui/InGameMessage.cpp index dfd9c60f..c82b19fc 100644 --- a/src/od-pandora/gui/InGameMessage.cpp +++ b/src/od-pandora/gui/InGameMessage.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -11,9 +11,9 @@ #include "uae.h" #include "gui.h" #include "gui_handling.h" -#include "pandora_gfx.h" -//extern SDL_Surface *amigaSurface; + +extern SDL_Surface *prSDLScreen; extern void flush_screen(); static int msg_done = 0; @@ -33,7 +33,7 @@ void InGameMessage(const char *msg) gcn::Gui* msg_gui; gcn::SDLGraphics* msg_graphics; gcn::SDLInput* msg_input; - gcn::SDLTrueTypeFont* msg_font; + gcn::contrib::SDLTrueTypeFont* msg_font; gcn::Color msg_baseCol; gcn::Container* msg_top; @@ -45,7 +45,7 @@ void InGameMessage(const char *msg) int msgHeight = 100; msg_graphics = new gcn::SDLGraphics(); - msg_graphics->setTarget(amigaSurface); + msg_graphics->setTarget(prSDLScreen); msg_input = new gcn::SDLInput(); msg_gui = new gcn::Gui(); msg_gui->setGraphics(msg_graphics); @@ -56,12 +56,12 @@ void InGameMessage(const char *msg) msg_baseCol.b = 208; msg_top = new gcn::Container(); - msg_top->setDimension(gcn::Rectangle((amigaSurface->w - msgWidth) / 2, (amigaSurface->h - msgHeight) / 2, msgWidth, msgHeight)); + msg_top->setDimension(gcn::Rectangle((prSDLScreen->w - msgWidth) / 2, (prSDLScreen->h - msgHeight) / 2, msgWidth, msgHeight)); msg_top->setBaseColor(msg_baseCol); msg_gui->setTop(msg_top); TTF_Init(); - msg_font = new gcn::SDLTrueTypeFont("data/FreeSans.ttf", 10); + msg_font = new gcn::contrib::SDLTrueTypeFont("data/FreeSans.ttf", 10); gcn::Widget::setGlobalFont(msg_font); doneActionListener = new DoneActionListener(); @@ -104,32 +104,27 @@ void InGameMessage(const char *msg) { switch (event.key.keysym.sym) { + case SDLK_PAGEDOWN: + case SDLK_HOME: case SDLK_RETURN: msg_done = 1; break; } } - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- + //------------------------------------------------- + // Send event to guichan-controls + //------------------------------------------------- msg_input->pushInput(event); } - // Now we let the Gui object perform its logic. + // Now we let the Gui object perform its logic. msg_gui->logic(); // Now we let the Gui object draw itself. msg_gui->draw(); // Finally we update the screen. if (!drawn) - { - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); - } + SDL_Flip(prSDLScreen); drawn = true; } diff --git a/src/od-pandora/gui/Navigation.cpp b/src/od-pandora/gui/Navigation.cpp index 42ef2c33..1f6d0cf3 100644 --- a/src/od-pandora/gui/Navigation.cpp +++ b/src/od-pandora/gui/Navigation.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" diff --git a/src/od-pandora/gui/PanelCPU.cpp b/src/od-pandora/gui/PanelCPU.cpp index 63d904e7..a408a8ca 100644 --- a/src/od-pandora/gui/PanelCPU.cpp +++ b/src/od-pandora/gui/PanelCPU.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeCheckBox.hpp" @@ -14,6 +14,7 @@ #include "gui.h" #include "gui_handling.h" + static gcn::Window *grpCPU; static gcn::UaeRadioButton* optCPU68000; static gcn::UaeRadioButton* optCPU68010; diff --git a/src/od-pandora/gui/PanelChipset.cpp b/src/od-pandora/gui/PanelChipset.cpp index 07f31060..ec54728b 100644 --- a/src/od-pandora/gui/PanelChipset.cpp +++ b/src/od-pandora/gui/PanelChipset.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeCheckBox.hpp" diff --git a/src/od-pandora/gui/PanelConfig.cpp b/src/od-pandora/gui/PanelConfig.cpp index 3c48dabb..0082bd4b 100644 --- a/src/od-pandora/gui/PanelConfig.cpp +++ b/src/od-pandora/gui/PanelConfig.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeListBox.hpp" @@ -14,6 +14,7 @@ #include "gui.h" #include "gui_handling.h" + static char last_active_config[MAX_PATH] = { '\0' }; static int ensureVisible = -1; @@ -313,7 +314,7 @@ void InitPanelConfig(const struct _ConfigCategory& category) lstConfigs->addActionListener(configsListActionListener); scrAreaConfigs = new gcn::ScrollArea(lstConfigs); - scrAreaConfigs->setBorderSize(1); + scrAreaConfigs->setFrameSize(1); scrAreaConfigs->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); scrAreaConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 2, 252); scrAreaConfigs->setScrollbarWidth(20); diff --git a/src/od-pandora/gui/PanelDisplay.cpp b/src/od-pandora/gui/PanelDisplay.cpp index 2cccc5db..b0ec0aa7 100644 --- a/src/od-pandora/gui/PanelDisplay.cpp +++ b/src/od-pandora/gui/PanelDisplay.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -16,8 +16,14 @@ #include "gui.h" #include "gui_handling.h" + const int amigawidth_values[] = { 320, 352, 384, 640, 704, 768 }; const int amigaheight_values[] = { 200, 216, 240, 256, 262, 270 }; +#ifdef RASPBERRY +const int FullscreenRatio[] = { 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97,98, 99,100 + }; +#endif static gcn::Window *grpAmigaScreen; static gcn::Label* lblAmigaWidth; @@ -30,6 +36,14 @@ static gcn::Label* lblVertPos; static gcn::Label* lblVertPosInfo; static gcn::Slider* sldVertPos; static gcn::UaeCheckBox* chkFrameskip; +#ifdef RASPBERRY +static gcn::Label* lblFSRatio; +static gcn::Label* lblFSRatioInfo; +static gcn::Slider* sldFSRatio; + +static gcn::UaeCheckBox* chkAspect; +#endif + class AmigaScreenActionListener : public gcn::ActionListener { @@ -64,6 +78,18 @@ public: { changed_prefs.gfx_framerate = chkFrameskip->isSelected() ? 1 : 0; } +#ifdef RASPBERRY + else if (actionEvent.getSource() == sldFSRatio) + { + if(changed_prefs.gfx_fullscreen_ratio != FullscreenRatio[(int)(sldFSRatio->getValue())]) + { + changed_prefs.gfx_fullscreen_ratio = FullscreenRatio[(int)(sldFSRatio->getValue())]; + RefreshPanelDisplay(); + } + } + else if (actionEvent.getSource() == chkAspect) + changed_prefs.gfx_correct_aspect = chkAspect->isSelected(); +#endif } }; AmigaScreenActionListener* amigaScreenActionListener; @@ -108,6 +134,27 @@ void InitPanelDisplay(const struct _ConfigCategory& category) sldVertPos->setId("sldVertPos"); sldVertPos->addActionListener(amigaScreenActionListener); lblVertPosInfo = new gcn::Label("000"); + + +#ifdef RASPBERRY + lblFSRatio = new gcn::Label("Fullscreen Ratio:"); + lblFSRatio->setSize(150, LABEL_HEIGHT); + lblFSRatio->setAlignment(gcn::Graphics::RIGHT); + sldFSRatio = new gcn::Slider(0, 20); + sldFSRatio->setSize(160, SLIDER_HEIGHT); + sldFSRatio->setBaseColor(gui_baseCol); + sldFSRatio->setMarkerLength(20); + sldFSRatio->setStepLength(1); + sldFSRatio->setId("FSRatio"); + sldFSRatio->addActionListener(amigaScreenActionListener); + lblFSRatioInfo = new gcn::Label("100%%"); + + chkAspect = new gcn::UaeCheckBox("4/3 ratio shrink"); + chkAspect->setId("4by3Ratio"); + chkAspect->addActionListener(amigaScreenActionListener); + +#endif + chkFrameskip = new gcn::UaeCheckBox("Frameskip"); chkFrameskip->addActionListener(amigaScreenActionListener); @@ -128,14 +175,28 @@ void InitPanelDisplay(const struct _ConfigCategory& category) grpAmigaScreen->add(lblVertPosInfo, 160 + sldVertPos->getWidth() + 12, posY); posY += sldVertPos->getHeight() + DISTANCE_NEXT_Y; +#ifdef RASPBERRY + grpAmigaScreen->add(lblFSRatio, 0, posY); + grpAmigaScreen->add(sldFSRatio, 160, posY); + grpAmigaScreen->add(lblFSRatioInfo, 160 + sldFSRatio->getWidth() + 12, posY); + posY += sldFSRatio->getHeight() + DISTANCE_NEXT_Y; +#endif + + grpAmigaScreen->setMovable(false); grpAmigaScreen->setSize(460, posY + DISTANCE_BORDER); grpAmigaScreen->setBaseColor(gui_baseCol); category.panel->add(grpAmigaScreen); - category.panel->add(chkFrameskip, DISTANCE_BORDER, DISTANCE_BORDER + grpAmigaScreen->getHeight() + DISTANCE_NEXT_Y); - RefreshPanelDisplay(); +#ifdef RASPBERRY + category.panel->add(chkAspect, DISTANCE_BORDER, DISTANCE_BORDER + grpAmigaScreen->getHeight() + DISTANCE_NEXT_Y); + category.panel->add(chkFrameskip, DISTANCE_BORDER, DISTANCE_BORDER + grpAmigaScreen->getHeight() + chkAspect->getHeight() + 2*DISTANCE_NEXT_Y); +#else + category.panel->add(chkFrameskip, DISTANCE_BORDER, DISTANCE_BORDER + grpAmigaScreen->getHeight() + DISTANCE_NEXT_Y); +#endif + + RefreshPanelDisplay(); } @@ -153,6 +214,13 @@ void ExitPanelDisplay(void) delete grpAmigaScreen; delete chkFrameskip; delete amigaScreenActionListener; +#ifdef RASPBERRY + delete lblFSRatio; + delete sldFSRatio; + delete lblFSRatioInfo; + + delete chkAspect; +#endif } @@ -183,6 +251,21 @@ void RefreshPanelDisplay(void) } } +#ifdef RASPBERRY + for(i=0; i<21; ++i) + { + if(changed_prefs.gfx_fullscreen_ratio == FullscreenRatio[i]) + { + sldFSRatio->setValue(i); + snprintf(tmp, 32, "%d%%", changed_prefs.gfx_fullscreen_ratio); + lblFSRatioInfo->setCaption(tmp); + break; + } + } + + chkAspect->setSelected(changed_prefs.gfx_correct_aspect); +#endif + sldVertPos->setValue(changed_prefs.pandora_vertical_offset); snprintf(tmp, 32, "%d", changed_prefs.pandora_vertical_offset); lblVertPosInfo->setCaption(tmp); diff --git a/src/od-pandora/gui/PanelFloppy.cpp b/src/od-pandora/gui/PanelFloppy.cpp index 9296e976..5c134a5d 100644 --- a/src/od-pandora/gui/PanelFloppy.cpp +++ b/src/od-pandora/gui/PanelFloppy.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" diff --git a/src/od-pandora/gui/PanelHD.cpp b/src/od-pandora/gui/PanelHD.cpp index b984cbcb..cac8c5b8 100644 --- a/src/od-pandora/gui/PanelHD.cpp +++ b/src/od-pandora/gui/PanelHD.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -19,6 +19,7 @@ #include "gui.h" #include "gui_handling.h" + enum { COL_DEVICE, COL_VOLUME, COL_PATH, COL_READWRITE, COL_SIZE, COL_BOOTPRI, COL_COUNT }; static const char *column_caption[] = @@ -328,7 +329,7 @@ void InitPanelHD(const struct _ConfigCategory& category) listEntry[row] = new gcn::Container(); listEntry[row]->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER, TEXTFIELD_HEIGHT + 4); listEntry[row]->setBaseColor(gui_baseCol); - listEntry[row]->setBorderSize(0); + listEntry[row]->setFrameSize(0); listCmdProps[row] = new gcn::Button("..."); listCmdProps[row]->setBaseColor(gui_baseCol); diff --git a/src/od-pandora/gui/PanelInput.cpp b/src/od-pandora/gui/PanelInput.cpp index b7358e5d..68ba5270 100644 --- a/src/od-pandora/gui/PanelInput.cpp +++ b/src/od-pandora/gui/PanelInput.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -20,6 +20,7 @@ #include "keyboard.h" #include "inputdevice.h" + static const char *mousespeed_list[] = { ".25", ".5", "1x", "2x", "4x" }; static const int mousespeed_values[] = { 2, 5, 10, 20, 40 }; @@ -149,7 +150,7 @@ static int amigaKey[] = AK_F2, AK_F3, AK_F4, AK_F5, AK_F6, AK_F7, AK_F8, AK_F9, /* 101 - 108 */ AK_F10, 0 }; /* 109 - 110 */ -//extern int customControlMap[SDLK_LAST]; +extern int customControlMap[SDLK_LAST]; static int GetAmigaKeyIndex(int key) { @@ -266,38 +267,38 @@ public: changed_prefs.input_tablet = chkMouseHack->isSelected() ? TABLET_MOUSEHACK : TABLET_OFF; } #endif -// else if (actionEvent.getSource() == chkCustomCtrl) -// changed_prefs.pandora_customControls = chkCustomCtrl->isSelected() ? 1 : 0; -// -// else if (actionEvent.getSource() == cboA) -// customControlMap[SDLK_HOME] = amigaKey[cboA->getSelected()]; -// -// else if (actionEvent.getSource() == cboB) -// customControlMap[SDLK_END] = amigaKey[cboB->getSelected()]; -// -// else if (actionEvent.getSource() == cboX) -// customControlMap[SDLK_PAGEDOWN] = amigaKey[cboX->getSelected()]; -// -// else if (actionEvent.getSource() == cboY) -// customControlMap[SDLK_PAGEUP] = amigaKey[cboY->getSelected()]; -// -// else if (actionEvent.getSource() == cboL) -// customControlMap[SDLK_RSHIFT] = amigaKey[cboL->getSelected()]; -// -// else if (actionEvent.getSource() == cboR) -// customControlMap[SDLK_RCTRL] = amigaKey[cboR->getSelected()]; -// -// else if (actionEvent.getSource() == cboUp) -// customControlMap[SDLK_UP] = amigaKey[cboUp->getSelected()]; -// -// else if (actionEvent.getSource() == cboDown) -// customControlMap[SDLK_DOWN] = amigaKey[cboDown->getSelected()]; -// -// else if (actionEvent.getSource() == cboLeft) -// customControlMap[SDLK_LEFT] = amigaKey[cboLeft->getSelected()]; -// -// else if (actionEvent.getSource() == cboRight) -// customControlMap[SDLK_RIGHT] = amigaKey[cboRight->getSelected()]; + else if (actionEvent.getSource() == chkCustomCtrl) + changed_prefs.pandora_customControls = chkCustomCtrl->isSelected() ? 1 : 0; + + else if (actionEvent.getSource() == cboA) + customControlMap[SDLK_HOME] = amigaKey[cboA->getSelected()]; + + else if (actionEvent.getSource() == cboB) + customControlMap[SDLK_END] = amigaKey[cboB->getSelected()]; + + else if (actionEvent.getSource() == cboX) + customControlMap[SDLK_PAGEDOWN] = amigaKey[cboX->getSelected()]; + + else if (actionEvent.getSource() == cboY) + customControlMap[SDLK_PAGEUP] = amigaKey[cboY->getSelected()]; + + else if (actionEvent.getSource() == cboL) + customControlMap[SDLK_RSHIFT] = amigaKey[cboL->getSelected()]; + + else if (actionEvent.getSource() == cboR) + customControlMap[SDLK_RCTRL] = amigaKey[cboR->getSelected()]; + + else if (actionEvent.getSource() == cboUp) + customControlMap[SDLK_UP] = amigaKey[cboUp->getSelected()]; + + else if (actionEvent.getSource() == cboDown) + customControlMap[SDLK_DOWN] = amigaKey[cboDown->getSelected()]; + + else if (actionEvent.getSource() == cboLeft) + customControlMap[SDLK_LEFT] = amigaKey[cboLeft->getSelected()]; + + else if (actionEvent.getSource() == cboRight) + customControlMap[SDLK_RIGHT] = amigaKey[cboRight->getSelected()]; else if (actionEvent.getSource() == KeyForMenu) changed_prefs.key_for_menu = ControlKey_SDLKeyValues[KeyForMenu->getSelected()] ; @@ -658,17 +659,17 @@ void RefreshPanelInput(void) chkMouseHack->setSelected(changed_prefs.input_tablet == TABLET_MOUSEHACK); #endif -// chkCustomCtrl->setSelected(changed_prefs.pandora_customControls); -// cboA->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_HOME])); -// cboB->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_END])); -// cboX->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_PAGEDOWN])); -// cboY->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_PAGEUP])); -// cboL->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_RSHIFT])); -// cboR->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_RCTRL])); -// cboUp->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_UP])); -// cboDown->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_DOWN])); -// cboLeft->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_LEFT])); -// cboRight->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_RIGHT])); + chkCustomCtrl->setSelected(changed_prefs.pandora_customControls); + cboA->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_HOME])); + cboB->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_END])); + cboX->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_PAGEDOWN])); + cboY->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_PAGEUP])); + cboL->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_RSHIFT])); + cboR->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_RCTRL])); + cboUp->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_UP])); + cboDown->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_DOWN])); + cboLeft->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_LEFT])); + cboRight->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_RIGHT])); for(i=0; i<4; ++i) { diff --git a/src/od-pandora/gui/PanelMisc.cpp b/src/od-pandora/gui/PanelMisc.cpp index 2f9a1165..8fabf8d0 100644 --- a/src/od-pandora/gui/PanelMisc.cpp +++ b/src/od-pandora/gui/PanelMisc.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -18,6 +18,7 @@ #include "gui.h" #include "gui_handling.h" + static gcn::UaeCheckBox* chkStatusLine; static gcn::UaeCheckBox* chkHideIdleLed; static gcn::UaeCheckBox* chkShowGUI; diff --git a/src/od-pandora/gui/PanelPaths.cpp b/src/od-pandora/gui/PanelPaths.cpp index 8dc1b5e4..eaab7dd1 100644 --- a/src/od-pandora/gui/PanelPaths.cpp +++ b/src/od-pandora/gui/PanelPaths.cpp @@ -1,8 +1,7 @@ -#include -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "sysconfig.h" diff --git a/src/od-pandora/gui/PanelRAM.cpp b/src/od-pandora/gui/PanelRAM.cpp index acbea811..35587dad 100644 --- a/src/od-pandora/gui/PanelRAM.cpp +++ b/src/od-pandora/gui/PanelRAM.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -16,6 +16,7 @@ #include "gui.h" #include "gui_handling.h" + static const char *ChipMem_list[] = { "512 K", "1 MB", "2 MB", "4 MB", "8 MB" }; static const int ChipMem_values[] = { 0x080000, 0x100000, 0x200000, 0x400000, 0x800000 }; static const char *SlowMem_list[] = { "None", "512 K", "1 MB", "1.5 MB", "1.8 MB" }; diff --git a/src/od-pandora/gui/PanelROM.cpp b/src/od-pandora/gui/PanelROM.cpp index 46ef0cdc..f34ae010 100644 --- a/src/od-pandora/gui/PanelROM.cpp +++ b/src/od-pandora/gui/PanelROM.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" diff --git a/src/od-pandora/gui/PanelSavestate.cpp b/src/od-pandora/gui/PanelSavestate.cpp index 939db94f..daf6b44b 100644 --- a/src/od-pandora/gui/PanelSavestate.cpp +++ b/src/od-pandora/gui/PanelSavestate.cpp @@ -1,8 +1,8 @@ -#include -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeCheckBox.hpp" @@ -22,6 +22,7 @@ #include "savestate.h" #include "gui_handling.h" + int currentStateNum = 0; static gcn::Window *grpNumber; diff --git a/src/od-pandora/gui/PanelSound.cpp b/src/od-pandora/gui/PanelSound.cpp index 2fe9c6c7..7beb8b0d 100644 --- a/src/od-pandora/gui/PanelSound.cpp +++ b/src/od-pandora/gui/PanelSound.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeCheckBox.hpp" @@ -19,6 +19,7 @@ #include "gui_handling.h" #include "sd-pandora/sound.h" + static gcn::Window *grpSound; static gcn::UaeRadioButton* optSoundDisabled; static gcn::UaeRadioButton* optSoundDisabledEmu; diff --git a/src/od-pandora/gui/SelectFile.cpp b/src/od-pandora/gui/SelectFile.cpp index aae46ecf..f61ac801 100644 --- a/src/od-pandora/gui/SelectFile.cpp +++ b/src/od-pandora/gui/SelectFile.cpp @@ -1,10 +1,10 @@ #include -#include +#include #include #include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -14,7 +14,7 @@ #include "fsdb.h" #include "gui.h" #include "gui_handling.h" -#include "pandora_gfx.h" + #define DIALOG_WIDTH 520 #define DIALOG_HEIGHT 400 @@ -218,7 +218,7 @@ static void InitSelectFile(const char *title) lstFiles->addActionListener(selectFileActionListener); scrAreaFiles = new gcn::ScrollArea(lstFiles); - scrAreaFiles->setBorderSize(1); + scrAreaFiles->setFrameSize(1); scrAreaFiles->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10); scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272); scrAreaFiles->setScrollbarWidth(20); @@ -329,25 +329,29 @@ static void SelectFileLoop(void) continue; } break; + + case SDLK_PAGEDOWN: + case SDLK_HOME: + event.key.keysym.sym = SDLK_RETURN; + gui_input->pushInput(event); // Fire key down + event.type = SDL_KEYUP; // and the key up + break; } } - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- + //------------------------------------------------- + // Send event to guichan-controls + //------------------------------------------------- gui_input->pushInput(event); } - // Now we let the Gui object perform its logic. + // Now we let the Gui object perform its logic. uae_gui->logic(); // Now we let the Gui object draw itself. uae_gui->draw(); - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); + // Finally we update the screen. + wait_for_vsync(); + SDL_Flip(gui_screen); if (!dialogCreated) { diff --git a/src/od-pandora/gui/SelectFolder.cpp b/src/od-pandora/gui/SelectFolder.cpp index eff4797b..c34163d4 100644 --- a/src/od-pandora/gui/SelectFolder.cpp +++ b/src/od-pandora/gui/SelectFolder.cpp @@ -1,10 +1,10 @@ #include -#include +#include #include #include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -12,7 +12,7 @@ #include "config.h" #include "uae.h" #include "gui_handling.h" -#include "pandora_gfx.h" + #define DIALOG_WIDTH 520 #define DIALOG_HEIGHT 400 @@ -152,7 +152,7 @@ static void InitSelectFolder(const char *title) lstFolders->addActionListener(listBoxActionListener); scrAreaFolders = new gcn::ScrollArea(lstFolders); - scrAreaFolders->setBorderSize(1); + scrAreaFolders->setFrameSize(1); scrAreaFolders->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10); scrAreaFolders->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272); scrAreaFolders->setScrollbarWidth(20); @@ -231,25 +231,29 @@ static void SelectFolderLoop(void) continue; } break; + + case SDLK_PAGEDOWN: + case SDLK_HOME: + event.key.keysym.sym = SDLK_RETURN; + gui_input->pushInput(event); // Fire key down + event.type = SDL_KEYUP; // and the key up + break; } } - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- + //------------------------------------------------- + // Send event to guichan-controls + //------------------------------------------------- gui_input->pushInput(event); } - // Now we let the Gui object perform its logic. + // Now we let the Gui object perform its logic. uae_gui->logic(); // Now we let the Gui object draw itself. uae_gui->draw(); - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); + // Finally we update the screen. + wait_for_vsync(); + SDL_Flip(gui_screen); } } diff --git a/src/od-pandora/gui/SelectorEntry.cpp b/src/od-pandora/gui/SelectorEntry.cpp index f7c53316..3615a354 100644 --- a/src/od-pandora/gui/SelectorEntry.cpp +++ b/src/od-pandora/gui/SelectorEntry.cpp @@ -1,8 +1,8 @@ #include "od-pandora/gui/SelectorEntry.hpp" -#include "guisan/widgets/container.hpp" -#include "guisan/widgets/icon.hpp" -#include "guisan/widgets/label.hpp" +#include "guichan/widgets/container.hpp" +#include "guichan/widgets/icon.hpp" +#include "guichan/widgets/label.hpp" namespace gcn diff --git a/src/od-pandora/gui/SelectorEntry.hpp b/src/od-pandora/gui/SelectorEntry.hpp index da42458d..60207f03 100644 --- a/src/od-pandora/gui/SelectorEntry.hpp +++ b/src/od-pandora/gui/SelectorEntry.hpp @@ -3,10 +3,10 @@ #include -#include "guisan/basiccontainer.hpp" -#include "guisan/graphics.hpp" -#include "guisan/platform.hpp" -#include "guisan/widgetlistener.hpp" +#include "guichan/basiccontainer.hpp" +#include "guichan/graphics.hpp" +#include "guichan/platform.hpp" +#include "guichan/widgetlistener.hpp" namespace gcn diff --git a/src/od-pandora/gui/ShowMessage.cpp b/src/od-pandora/gui/ShowMessage.cpp index cdbea0fd..18620c0b 100644 --- a/src/od-pandora/gui/ShowMessage.cpp +++ b/src/od-pandora/gui/ShowMessage.cpp @@ -1,10 +1,10 @@ #include -#include +#include #include #include -#include -#include -#include "guisan/sdl/sdltruetypefont.hpp" +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -12,7 +12,7 @@ #include "config.h" #include "gui.h" #include "gui_handling.h" -#include "pandora_gfx.h" + #define DIALOG_WIDTH 340 #define DIALOG_HEIGHT 140 @@ -122,6 +122,13 @@ static void ShowMessageLoop(void) continue; } break; + + case SDLK_PAGEDOWN: + case SDLK_HOME: + event.key.keysym.sym = SDLK_RETURN; + gui_input->pushInput(event); // Fire key down + event.type = SDL_KEYUP; // and the key up + break; } } @@ -135,12 +142,9 @@ static void ShowMessageLoop(void) uae_gui->logic(); // Now we let the Gui object draw itself. uae_gui->draw(); - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); + // Finally we update the screen. + wait_for_vsync(); + SDL_Flip(gui_screen); } } diff --git a/src/od-pandora/gui/UaeCheckBox.cpp b/src/od-pandora/gui/UaeCheckBox.cpp index 8e41f9db..572b997d 100644 --- a/src/od-pandora/gui/UaeCheckBox.cpp +++ b/src/od-pandora/gui/UaeCheckBox.cpp @@ -1,10 +1,10 @@ #include "UaeCheckBox.hpp" -#include "guisan/widgets/checkbox.hpp" +#include "guichan/widgets/checkbox.hpp" -#include "guisan/font.hpp" -#include "guisan/graphics.hpp" -#include "guisan/key.hpp" -#include "guisan/mouseinput.hpp" +#include "guichan/font.hpp" +#include "guichan/graphics.hpp" +#include "guichan/key.hpp" +#include "guichan/mouseinput.hpp" namespace gcn diff --git a/src/od-pandora/gui/UaeCheckBox.hpp b/src/od-pandora/gui/UaeCheckBox.hpp index 5e77ea20..d8ad9275 100644 --- a/src/od-pandora/gui/UaeCheckBox.hpp +++ b/src/od-pandora/gui/UaeCheckBox.hpp @@ -4,11 +4,11 @@ #include #include -#include "guisan/keylistener.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" -#include "guisan/widgets/checkbox.hpp" +#include "guichan/keylistener.hpp" +#include "guichan/mouselistener.hpp" +#include "guichan/platform.hpp" +#include "guichan/widget.hpp" +#include "guichan/widgets/checkbox.hpp" namespace gcn diff --git a/src/od-pandora/gui/UaeDropDown.cpp b/src/od-pandora/gui/UaeDropDown.cpp index b32216b7..0bdc947f 100644 --- a/src/od-pandora/gui/UaeDropDown.cpp +++ b/src/od-pandora/gui/UaeDropDown.cpp @@ -1,10 +1,10 @@ #include "UaeDropDown.hpp" -#include "guisan/widgets/dropdown.hpp" +#include "guichan/widgets/dropdown.hpp" -#include "guisan/font.hpp" -#include "guisan/graphics.hpp" -#include "guisan/key.hpp" -#include "guisan/mouseinput.hpp" +#include "guichan/font.hpp" +#include "guichan/graphics.hpp" +#include "guichan/key.hpp" +#include "guichan/mouseinput.hpp" namespace gcn @@ -40,13 +40,13 @@ void UaeDropDown::keyPressed(KeyEvent& keyEvent) { setSelected(getSelected() - 1); keyEvent.consume(); - distributeValueChangedEvent(); + distributeActionEvent(); } else if (key.getValue() == Key::DOWN) { setSelected(getSelected() + 1); keyEvent.consume(); - distributeValueChangedEvent(); + distributeActionEvent(); } } diff --git a/src/od-pandora/gui/UaeDropDown.hpp b/src/od-pandora/gui/UaeDropDown.hpp index 2251d6a6..93f632eb 100644 --- a/src/od-pandora/gui/UaeDropDown.hpp +++ b/src/od-pandora/gui/UaeDropDown.hpp @@ -4,11 +4,11 @@ #include #include -#include "guisan/keylistener.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" -#include "guisan/widgets/dropdown.hpp" +#include "guichan/keylistener.hpp" +#include "guichan/mouselistener.hpp" +#include "guichan/platform.hpp" +#include "guichan/widget.hpp" +#include "guichan/widgets/dropdown.hpp" namespace gcn diff --git a/src/od-pandora/gui/UaeListBox.cpp b/src/od-pandora/gui/UaeListBox.cpp index 30ff7fbd..dee69848 100644 --- a/src/od-pandora/gui/UaeListBox.cpp +++ b/src/od-pandora/gui/UaeListBox.cpp @@ -1,13 +1,13 @@ #include "UaeListBox.hpp" -#include "guisan/widgets/listbox.hpp" +#include "guichan/widgets/listbox.hpp" -#include "guisan/basiccontainer.hpp" -#include "guisan/font.hpp" -#include "guisan/graphics.hpp" -#include "guisan/key.hpp" -#include "guisan/listmodel.hpp" -#include "guisan/mouseinput.hpp" -#include "guisan/selectionlistener.hpp" +#include "guichan/basiccontainer.hpp" +#include "guichan/font.hpp" +#include "guichan/graphics.hpp" +#include "guichan/key.hpp" +#include "guichan/listmodel.hpp" +#include "guichan/mouseinput.hpp" +#include "guichan/selectionlistener.hpp" namespace gcn @@ -43,7 +43,7 @@ void UaeListBox::draw(Graphics* graphics) // Check the current clip area so we don't draw unnecessary items // that are not visible. const ClipRectangle currentClipArea = graphics->getCurrentClipArea(); - int rowHeight = getHeight(); + int rowHeight = getRowHeight(); // Calculate the number of rows to draw by checking the clip area. // The addition of two makes covers a partial visible row at the top diff --git a/src/od-pandora/gui/UaeListBox.hpp b/src/od-pandora/gui/UaeListBox.hpp index 7c317a8c..1fdae225 100644 --- a/src/od-pandora/gui/UaeListBox.hpp +++ b/src/od-pandora/gui/UaeListBox.hpp @@ -3,12 +3,12 @@ #include -#include "guisan/keylistener.hpp" -#include "guisan/listmodel.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" -#include "guisan/widgets/listbox.hpp" +#include "guichan/keylistener.hpp" +#include "guichan/listmodel.hpp" +#include "guichan/mouselistener.hpp" +#include "guichan/platform.hpp" +#include "guichan/widget.hpp" +#include "guichan/widgets/listbox.hpp" namespace gcn diff --git a/src/od-pandora/gui/UaeRadioButton.cpp b/src/od-pandora/gui/UaeRadioButton.cpp index d1f49f14..e3bf27d9 100644 --- a/src/od-pandora/gui/UaeRadioButton.cpp +++ b/src/od-pandora/gui/UaeRadioButton.cpp @@ -1,10 +1,10 @@ #include "UaeRadioButton.hpp" -#include "guisan/widgets/radiobutton.hpp" +#include "guichan/widgets/radiobutton.hpp" -#include "guisan/font.hpp" -#include "guisan/graphics.hpp" -#include "guisan/key.hpp" -#include "guisan/mouseinput.hpp" +#include "guichan/font.hpp" +#include "guichan/graphics.hpp" +#include "guichan/key.hpp" +#include "guichan/mouseinput.hpp" namespace gcn diff --git a/src/od-pandora/gui/UaeRadioButton.hpp b/src/od-pandora/gui/UaeRadioButton.hpp index d563f53d..6041fa87 100644 --- a/src/od-pandora/gui/UaeRadioButton.hpp +++ b/src/od-pandora/gui/UaeRadioButton.hpp @@ -4,11 +4,11 @@ #include #include -#include "guisan/keylistener.hpp" -#include "guisan/mouselistener.hpp" -#include "guisan/platform.hpp" -#include "guisan/widget.hpp" -#include "guisan/widgets/radiobutton.hpp" +#include "guichan/keylistener.hpp" +#include "guichan/mouselistener.hpp" +#include "guichan/platform.hpp" +#include "guichan/widget.hpp" +#include "guichan/widgets/radiobutton.hpp" namespace gcn diff --git a/src/od-pandora/gui/gui_handling.h b/src/od-pandora/gui/gui_handling.h index fcf9d49c..a32d3fd5 100644 --- a/src/od-pandora/gui/gui_handling.h +++ b/src/od-pandora/gui/gui_handling.h @@ -33,7 +33,6 @@ extern gcn::Gui* uae_gui; extern gcn::Container* gui_top; extern gcn::Color gui_baseCol; extern gcn::SDLInput* gui_input; - extern SDL_Surface* gui_screen; extern char currentDir[MAX_DPATH]; diff --git a/src/od-pandora/gui/main_window.cpp b/src/od-pandora/gui/main_window.cpp index 269b019b..bb807efa 100644 --- a/src/od-pandora/gui/main_window.cpp +++ b/src/od-pandora/gui/main_window.cpp @@ -1,9 +1,7 @@ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include "sdltruetypefont.hpp" #include "SelectorEntry.hpp" #include "sysconfig.h" @@ -15,14 +13,11 @@ #include "gui_handling.h" #include "include/memory.h" #include "autoconf.h" -#include "pandora_gfx.h" -/* - * Common stuff we need - */ bool gui_running = false; static int last_active_panel = 1; + ConfigCategory categories[] = { { "Paths", "data/paths.ico", NULL, NULL, InitPanelPaths, ExitPanelPaths, RefreshPanelPaths }, @@ -45,30 +40,19 @@ enum { PANEL_PATHS, PANEL_CONFIGURATIONS, PANEL_CPU, PANEL_CHIPSET, PANEL_ROM, P NUM_PANELS }; -/* - * SDL Stuff we need - */ -SDL_Surface* gui_screen; -SDL_Event event; -/* - * Guisan SDL stuff we need - */ -gcn::SDLInput* gui_input; -gcn::SDLGraphics* gui_graphics; -gcn::SDLImageLoader* gui_imageLoader; -gcn::SDLTrueTypeFont* gui_font; - -/* - * Guisan stuff we need - */ gcn::Gui* uae_gui; -gcn::Container* gui_top; -gcn::Container* selectors; gcn::Color gui_baseCol; gcn::Color gui_baseColLabel; gcn::Color colSelectorInactive; gcn::Color colSelectorActive; +gcn::Container* gui_top; +gcn::Container* selectors; +gcn::contrib::SDLTrueTypeFont* gui_font; +SDL_Surface* gui_screen; +gcn::SDLGraphics* gui_graphics; +gcn::SDLInput* gui_input; +gcn::SDLImageLoader* gui_imageLoader; namespace widgets { @@ -79,6 +63,17 @@ namespace widgets gcn::Button* cmdStart; } + +/* Flag for changes in rtarea: + Bit 0: any HD in config? + Bit 1: force because add/remove HD was clicked + Bit 2: socket_emu on + Bit 3: mousehack on + Bit 4: rtgmem on + Bit 5: chipmem larger than 2MB + + gui_rtarea_flags_onenter is set before GUI is shown, bit 1 may change during GUI display. +*/ static int gui_rtarea_flags_onenter; static int gui_create_rtarea_flag(struct uae_prefs *p) @@ -120,28 +115,37 @@ namespace sdl { void gui_init() { + //------------------------------------------------- + // Set layer for GUI screen + //------------------------------------------------- + char tmp[20]; + snprintf(tmp, 20, "%dx%d", GUI_WIDTH, GUI_HEIGHT); + setenv("SDL_OMAP_LAYER_SIZE", tmp, 1); + snprintf(tmp, 20, "0,0,0,0"); + setenv("SDL_OMAP_BORDER_CUT", tmp, 1); + //------------------------------------------------- // Create new screen for GUI //------------------------------------------------- - gui_screen = SDL_CreateRGBSurface(0, GUI_WIDTH, GUI_HEIGHT, 32, 0, 0, 0, 0); - check_error_sdl(gui_screen == nullptr, "Unable to create a surface"); - + #if defined (RASPBERRY) + const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo (); + printf("Current resolution: %d x %d %d bpp\n",videoInfo->current_w, videoInfo->current_h, videoInfo->vfmt->BitsPerPixel); + gui_screen = SDL_SetVideoMode(videoInfo->current_w, videoInfo->current_h, videoInfo->vfmt->BitsPerPixel, SDL_SWSURFACE); + #else + gui_screen = SDL_SetVideoMode(GUI_WIDTH, GUI_HEIGHT, 16, SDL_SWSURFACE); + #endif + SDL_EnableUNICODE(1); + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); SDL_ShowCursor(SDL_ENABLE); //------------------------------------------------- // Create helpers for guichan //------------------------------------------------- gui_imageLoader = new gcn::SDLImageLoader(); - // The ImageLoader in use is static and must be set to be - // able to load images gcn::Image::setImageLoader(gui_imageLoader); gui_graphics = new gcn::SDLGraphics(); - // Set the target for the graphics object to be the screen. - // In other words, we will draw to the screen. - // Note, any surface will do, it doesn't have to be the screen. gui_graphics->setTarget(gui_screen); gui_input = new gcn::SDLInput(); - uae_gui = new gcn::Gui(); uae_gui->setGraphics(gui_graphics); uae_gui->setInput(gui_input); @@ -158,91 +162,6 @@ namespace sdl gui_screen = NULL; } - void checkInput() - { - while (SDL_PollEvent(&event)) - { - if (event.type == SDL_KEYDOWN) - { - gcn::FocusHandler* focusHdl; - gcn::Widget* activeWidget; - - if (event.key.keysym.sym == currprefs.key_for_menu) - { - if (emulating && widgets::cmdStart->isEnabled()) - { - //------------------------------------------------ - // Continue emulation - //------------------------------------------------ - gui_running = false; - } - else - { - //------------------------------------------------ - // First start of emulator -> reset Amiga - //------------------------------------------------ - uae_reset(0, 1); - gui_running = false; - } - } - else - switch (event.key.keysym.sym) - { - case SDLK_q: - //------------------------------------------------- - // Quit entire program via Q on keyboard - //------------------------------------------------- - focusHdl = gui_top->_getFocusHandler(); - activeWidget = focusHdl->getFocused(); - if (dynamic_cast(activeWidget) == NULL) - { - // ...but only if we are not in a Textfield... - uae_quit(); - gui_running = false; - } - break; - - case SDLK_ESCAPE: - uae_reset(1, 1); - gui_running = false; - break; - - case SDLK_UP: - if (HandleNavigation(DIRECTION_UP)) - continue; // Don't change value when enter ComboBox -> don't send event to control - break; - - case SDLK_DOWN: - if (HandleNavigation(DIRECTION_DOWN)) - continue; // Don't change value when enter ComboBox -> don't send event to control - break; - - case SDLK_LEFT: - if (HandleNavigation(DIRECTION_LEFT)) - continue; // Don't change value when enter Slider -> don't send event to control - break; - - case SDLK_RIGHT: - if (HandleNavigation(DIRECTION_RIGHT)) - continue; // Don't change value when enter Slider -> don't send event to control - break; - } - } - else if (event.type == SDL_QUIT) - { - //------------------------------------------------- - // Quit entire program via SQL-Quit - //------------------------------------------------- - uae_quit(); - gui_running = false; - } - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- - gui_input->pushInput(event); - } - } - void gui_run() { //------------------------------------------------- @@ -250,9 +169,110 @@ namespace sdl //------------------------------------------------- while(gui_running) { - // Poll input - checkInput(); - + //------------------------------------------------- + // Check user input + //------------------------------------------------- + SDL_Event event; + while(SDL_PollEvent(&event)) + { + if (event.type == SDL_QUIT) + { + //------------------------------------------------- + // Quit entire program via SQL-Quit + //------------------------------------------------- + uae_quit(); + gui_running = false; + break; + } + + else if (event.type == SDL_KEYDOWN) + { + gcn::FocusHandler* focusHdl; + gcn::Widget* activeWidget; + + + if (event.key.keysym.sym == currprefs.key_for_menu) + { + if(emulating && widgets::cmdStart->isEnabled()) + { + //------------------------------------------------ + // Continue emulation + //------------------------------------------------ + gui_running = false; + } + else + { + //------------------------------------------------ + // First start of emulator -> reset Amiga + //------------------------------------------------ + uae_reset(0,1); + gui_running = false; + } + } + else + switch(event.key.keysym.sym) + { + case SDLK_q: + //------------------------------------------------- + // Quit entire program via Q on keyboard + //------------------------------------------------- + focusHdl = gui_top->_getFocusHandler(); + activeWidget = focusHdl->getFocused(); + if(dynamic_cast(activeWidget) == NULL) + { + // ...but only if we are not in a Textfield... + uae_quit(); + gui_running = false; + } + break; + + case SDLK_ESCAPE: + // case SDLK_RCTRL: + //------------------------------------------------- + // Reset Amiga + //------------------------------------------------- + uae_reset(1,1); + gui_running = false; + break; + + case SDLK_PAGEDOWN: + case SDLK_HOME: + //------------------------------------------------ + // Simulate press of enter when 'X' pressed + //------------------------------------------------ + event.key.keysym.sym = SDLK_RETURN; + gui_input->pushInput(event); // Fire key down + event.type = SDL_KEYUP; // and the key up + break; + + case SDLK_UP: + if(HandleNavigation(DIRECTION_UP)) + continue; // Don't change value when enter ComboBox -> don't send event to control + break; + + case SDLK_DOWN: + if(HandleNavigation(DIRECTION_DOWN)) + continue; // Don't change value when enter ComboBox -> don't send event to control + break; + + case SDLK_LEFT: + if(HandleNavigation(DIRECTION_LEFT)) + continue; // Don't change value when enter Slider -> don't send event to control + break; + + case SDLK_RIGHT: + if(HandleNavigation(DIRECTION_RIGHT)) + continue; // Don't change value when enter Slider -> don't send event to control + break; + } + } + + //------------------------------------------------- + // Send event to guichan-controls + //------------------------------------------------- + gui_input->pushInput(event); + } + if(gui_rtarea_flags_onenter != gui_create_rtarea_flag(&changed_prefs)) DisableResume(); @@ -260,14 +280,19 @@ namespace sdl uae_gui->logic(); // Now we let the Gui object draw itself. uae_gui->draw(); - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, gui_screen->pixels, gui_screen->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); + // Finally we update the screen. + wait_for_vsync(); + SDL_Flip(gui_screen); + + if(refreshFuncAfterDraw != NULL) + { + void (*currFunc)(void) = refreshFuncAfterDraw; + refreshFuncAfterDraw = NULL; + currFunc(); + } } } + } @@ -385,7 +410,8 @@ void gui_init() // Create container for main page //------------------------------------------------- gui_top = new gcn::Container(); - gui_top->setDimension(gcn::Rectangle(0, 0, GUI_WIDTH, GUI_HEIGHT)); + //gui_top->setDimension(gcn::Rectangle(0, 0, GUI_WIDTH, GUI_HEIGHT)); + gui_top->setDimension(gcn::Rectangle((gui_screen->w - GUI_WIDTH) / 2, (gui_screen->h - GUI_HEIGHT) / 2, GUI_WIDTH, GUI_HEIGHT)); gui_top->setBaseColor(gui_baseCol); uae_gui->setTop(gui_top); @@ -393,7 +419,7 @@ void gui_init() // Initialize fonts //------------------------------------------------- TTF_Init(); - gui_font = new gcn::SDLTrueTypeFont("data/FreeSans.ttf", 14); + gui_font = new gcn::contrib::SDLTrueTypeFont("data/FreeSans.ttf", 14); gcn::Widget::setGlobalFont(gui_font); //-------------------------------------------------- @@ -434,7 +460,7 @@ void gui_init() selectors = new gcn::Container(); selectors->setSize(150, workAreaHeight - 2); selectors->setBaseColor(colSelectorInactive); - selectors->setBorderSize(1); + selectors->setFrameSize(1); int panelStartX = DISTANCE_BORDER + selectors->getWidth() + 2 + 11; panelFocusListener = new PanelFocusListener(); @@ -450,7 +476,7 @@ void gui_init() categories[i].panel->setId(categories[i].category); categories[i].panel->setSize(GUI_WIDTH - panelStartX - DISTANCE_BORDER - 1, workAreaHeight - 2); categories[i].panel->setBaseColor(gui_baseCol); - categories[i].panel->setBorderSize(1); + categories[i].panel->setFrameSize(1); categories[i].panel->setVisible(false); } diff --git a/src/od-pandora/gui/sdltruetypefont.cpp b/src/od-pandora/gui/sdltruetypefont.cpp new file mode 100644 index 00000000..c317e81a --- /dev/null +++ b/src/od-pandora/gui/sdltruetypefont.cpp @@ -0,0 +1,171 @@ +/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson + * + * + * Per Larsson a.k.a finalman + * Olof Naessén a.k.a jansem/yakslem + * + * Visit: http://guichan.sourceforge.net + * + * License: (BSD) + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Guichan nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * For comments regarding functions please see the header file. + */ + +#include "sdltruetypefont.hpp" + +#include "guichan/exception.hpp" +#include "guichan/image.hpp" +#include "guichan/graphics.hpp" +#include "guichan/sdl/sdlgraphics.hpp" + +namespace gcn +{ +namespace contrib +{ +SDLTrueTypeFont::SDLTrueTypeFont (const std::string& filename, int size) +{ + mRowSpacing = 0; + mGlyphSpacing = 0; + mAntiAlias = true; + mFilename = filename; + mFont = NULL; + + mFont = TTF_OpenFont(filename.c_str(), size); + + if (mFont == NULL) + { + throw GCN_EXCEPTION("SDLTrueTypeFont::SDLTrueTypeFont. "+std::string(TTF_GetError())); + } +} + +SDLTrueTypeFont::~SDLTrueTypeFont() +{ + TTF_CloseFont(mFont); +} + +int SDLTrueTypeFont::getWidth(const std::string& text) const +{ + int w, h; + TTF_SizeText(mFont, text.c_str(), &w, &h); + + return w; +} + +int SDLTrueTypeFont::getHeight() const +{ + return TTF_FontHeight(mFont) + mRowSpacing; +} + +void SDLTrueTypeFont::drawString(gcn::Graphics* graphics, const std::string& text, const int x, const int y) +{ + if (text == "") + { + return; + } + + gcn::SDLGraphics *sdlGraphics = dynamic_cast(graphics); + + if (sdlGraphics == NULL) + { + throw GCN_EXCEPTION("SDLTrueTypeFont::drawString. Graphics object not an SDL graphics object!"); + return; + } + + // This is needed for drawing the Glyph in the middle if we have spacing + int yoffset = getRowSpacing() / 2; + + Color col = sdlGraphics->getColor(); + + SDL_Color sdlCol; + sdlCol.b = col.b; + sdlCol.r = col.r; + sdlCol.g = col.g; + + SDL_Surface *textSurface; + if (mAntiAlias) + { + textSurface = TTF_RenderText_Blended(mFont, text.c_str(), sdlCol); + } + else + { + textSurface = TTF_RenderText_Solid(mFont, text.c_str(), sdlCol); + } + + SDL_Rect dst, src; + dst.x = x; + dst.y = y + yoffset; + src.w = textSurface->w; + src.h = textSurface->h; + src.x = 0; + src.y = 0; + + sdlGraphics->drawSDLSurface(textSurface, src, dst); + SDL_FreeSurface(textSurface); +} + +void SDLTrueTypeFont::setRowSpacing(int spacing) +{ + mRowSpacing = spacing; +} + +int SDLTrueTypeFont::getRowSpacing() +{ + return mRowSpacing; +} + +void SDLTrueTypeFont::setGlyphSpacing(int spacing) +{ + mGlyphSpacing = spacing; +} + +int SDLTrueTypeFont::getGlyphSpacing() +{ + return mGlyphSpacing; +} + +void SDLTrueTypeFont::setAntiAlias(bool antiAlias) +{ + mAntiAlias = antiAlias; +} + +bool SDLTrueTypeFont::isAntiAlias() +{ + return mAntiAlias; +} +} +} + diff --git a/src/include/guisan/sdl/sdltruetypefont.hpp b/src/od-pandora/gui/sdltruetypefont.hpp similarity index 51% rename from src/include/guisan/sdl/sdltruetypefont.hpp rename to src/od-pandora/gui/sdltruetypefont.hpp index c2061028..f0ccae20 100644 --- a/src/include/guisan/sdl/sdltruetypefont.hpp +++ b/src/od-pandora/gui/sdltruetypefont.hpp @@ -47,106 +47,109 @@ #include #include -#include +#include -#include "guisan/font.hpp" -#include "guisan/platform.hpp" +#include "guichan/font.hpp" +#include "guichan/platform.hpp" namespace gcn { - class Graphics; - - /** - * SDL True Type Font implementation of Font. It uses the SDL_ttf library - * to display True Type Fonts with SDL. - * - * NOTE: You must initialize the SDL_ttf library before using this - * class. Also, remember to call the SDL_ttf libraries quit - * function. - * - * @author Walluce Pinkham - * @author Olof Naessén - */ - class GCN_EXTENSION_DECLSPEC SDLTrueTypeFont: public Font - { - public: +class Graphics; +namespace contrib +{ - /** - * Constructor. - * - * @param filename the filename of the True Type Font. - * @param size the size the font should be in. - */ - SDLTrueTypeFont (const std::string& filename, int size); +/** + * SDL True Type Font implementation of Font. It uses the SDL_ttf library + * to display True Type Fonts with SDL. + * + * NOTE: You must initialize the SDL_ttf library before using this + * class. Also, remember to call the SDL_ttf libraries quit + * function. + * + * @author Walluce Pinkham + * @author Olof Naessén + */ +class GCN_EXTENSION_DECLSPEC SDLTrueTypeFont: public Font +{ +public: - /** - * Destructor. - */ - virtual ~SDLTrueTypeFont(); - - /** - * Sets the spacing between rows in pixels. Default is 0 pixels. - * The spacing can be negative. - * - * @param spacing the spacing in pixels. - */ - virtual void setRowSpacing (int spacing); - - /** - * Gets the spacing between rows in pixels. - * - * @return the spacing. - */ - virtual int getRowSpacing(); - - /** - * Sets the spacing between letters in pixels. Default is 0 pixels. - * The spacing can be negative. - * - * @param spacing the spacing in pixels. - */ - virtual void setGlyphSpacing(int spacing); + /** + * Constructor. + * + * @param filename the filename of the True Type Font. + * @param size the size the font should be in. + */ + SDLTrueTypeFont (const std::string& filename, int size); - /** - * Gets the spacing between letters in pixels. - * - * @return the spacing. - */ - virtual int getGlyphSpacing(); - - /** - * Sets the use of anti aliasing.. - * - * @param antaAlias true for use of antia aliasing. - */ - virtual void setAntiAlias(bool antiAlias); - - /** - * Checks if anti aliasing is used. - * - * @return true if anti aliasing is used. - */ - virtual bool isAntiAlias(); - - - // Inherited from Font - - virtual int getWidth(const std::string& text) const; - - virtual int getHeight() const; - - virtual void drawString(Graphics* graphics, const std::string& text, int x, int y); - - protected: - TTF_Font *mFont; - - int mHeight; - int mGlyphSpacing; - int mRowSpacing; - - std::string mFilename; - bool mAntiAlias; - }; + /** + * Destructor. + */ + virtual ~SDLTrueTypeFont(); + + /** + * Sets the spacing between rows in pixels. Default is 0 pixels. + * The spacing can be negative. + * + * @param spacing the spacing in pixels. + */ + virtual void setRowSpacing (int spacing); + + /** + * Gets the spacing between rows in pixels. + * + * @return the spacing. + */ + virtual int getRowSpacing(); + + /** + * Sets the spacing between letters in pixels. Default is 0 pixels. + * The spacing can be negative. + * + * @param spacing the spacing in pixels. + */ + virtual void setGlyphSpacing(int spacing); + + /** + * Gets the spacing between letters in pixels. + * + * @return the spacing. + */ + virtual int getGlyphSpacing(); + + /** + * Sets the use of anti aliasing.. + * + * @param antaAlias true for use of antia aliasing. + */ + virtual void setAntiAlias(bool antiAlias); + + /** + * Checks if anti aliasing is used. + * + * @return true if anti aliasing is used. + */ + virtual bool isAntiAlias(); + + + // Inherited from Font + + virtual int getWidth(const std::string& text) const; + + virtual int getHeight() const; + + virtual void drawString(Graphics* graphics, const std::string& text, int x, int y); + +protected: + TTF_Font *mFont; + + int mHeight; + int mGlyphSpacing; + int mRowSpacing; + + std::string mFilename; + bool mAntiAlias; +}; +} } #endif diff --git a/src/od-pandora/keyboard.cpp b/src/od-pandora/keyboard.cpp index 6791eda5..a5942746 100644 --- a/src/od-pandora/keyboard.cpp +++ b/src/od-pandora/keyboard.cpp @@ -13,7 +13,6 @@ #include "keybuf.h" #include "gui.h" #include -#include char keyboard_type = 0; @@ -290,16 +289,16 @@ static struct uae_input_device_kbr_default keytrans_amiga[] = { SDLK_8, INPUTEVENT_KEY_8 }, { SDLK_9, INPUTEVENT_KEY_9 }, - { SDLK_KP_0, INPUTEVENT_KEY_NP_0 }, - { SDLK_KP_1, INPUTEVENT_KEY_NP_1 }, - { SDLK_KP_2, INPUTEVENT_KEY_NP_2 }, - { SDLK_KP_3, INPUTEVENT_KEY_NP_3 }, - { SDLK_KP_4, INPUTEVENT_KEY_NP_4 }, - { SDLK_KP_5, INPUTEVENT_KEY_NP_5 }, - { SDLK_KP_6, INPUTEVENT_KEY_NP_6 }, - { SDLK_KP_7, INPUTEVENT_KEY_NP_7 }, - { SDLK_KP_8, INPUTEVENT_KEY_NP_8 }, - { SDLK_KP_9, INPUTEVENT_KEY_NP_9 }, + { SDLK_KP0, INPUTEVENT_KEY_NP_0 }, + { SDLK_KP1, INPUTEVENT_KEY_NP_1 }, + { SDLK_KP2, INPUTEVENT_KEY_NP_2 }, + { SDLK_KP3, INPUTEVENT_KEY_NP_3 }, + { SDLK_KP4, INPUTEVENT_KEY_NP_4 }, + { SDLK_KP5, INPUTEVENT_KEY_NP_5 }, + { SDLK_KP6, INPUTEVENT_KEY_NP_6 }, + { SDLK_KP7, INPUTEVENT_KEY_NP_7 }, + { SDLK_KP8, INPUTEVENT_KEY_NP_8 }, + { SDLK_KP9, INPUTEVENT_KEY_NP_9 }, { SDLK_KP_DIVIDE, INPUTEVENT_KEY_NP_DIV }, { SDLK_KP_MULTIPLY, INPUTEVENT_KEY_NP_MUL }, { SDLK_KP_MINUS, INPUTEVENT_KEY_NP_SUB }, @@ -379,25 +378,27 @@ static int *kbmaps[] = { kb_none, kb_none, kb_none, kb_none, kb_none, void keyboard_settrans (void) { -// const char* vid_drv_name = SDL_GetCurrentVideoDriver(); -// if (strcmp(vid_drv_name, "x11") == 0) -// { -// printf("Will use keycode from x11 mapping.\n"); -// keyboard_type = KEYCODE_X11; -// inputdevice_setkeytranslation (keytrans_x11, kbmaps); -// } -// else if (strcmp(vid_drv_name, "fbcon") == 0) -// { -// printf("Will use keycode from fbcon mapping.\n"); -// keyboard_type = KEYCODE_FBCON; -// inputdevice_setkeytranslation (keytrans_fbcon, kbmaps); -// } -// else -// { -// printf("Unknown keycode to use, will use keysym\n"); + char vid_drv_name[32]; + // get display type... + SDL_VideoDriverName(vid_drv_name, sizeof(vid_drv_name)); + if (strcmp(vid_drv_name, "x11") == 0) + { + printf("Will use keycode from x11 mapping.\n"); + keyboard_type = KEYCODE_X11; + inputdevice_setkeytranslation (keytrans_x11, kbmaps); + } + else if (strcmp(vid_drv_name, "fbcon") == 0) + { + printf("Will use keycode from fbcon mapping.\n"); + keyboard_type = KEYCODE_FBCON; + inputdevice_setkeytranslation (keytrans_fbcon, kbmaps); + } + else + { + printf("Unknown keycode to use, will use keysym\n"); keyboard_type = KEYCODE_UNK; inputdevice_setkeytranslation (keytrans, kbmaps); -// } + } } int translate_pandora_keys(int symbol, int *modifier) diff --git a/src/od-pandora/menu/menu_config.cpp b/src/od-pandora/menu/menu_config.cpp index 80301156..fc29f339 100644 --- a/src/od-pandora/menu/menu_config.cpp +++ b/src/od-pandora/menu/menu_config.cpp @@ -12,9 +12,9 @@ #include "custom.h" #include "uae.h" #include "disk.h" -#include +#include "SDL.h" -//extern int customControlMap[SDLK_LAST]; +extern int customControlMap[SDLK_LAST]; static int kickstart; @@ -486,16 +486,16 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath) fscanf(f, "cutRight=%d\n", &dummy); fscanf(f, "customControls=%d\n", &p->pandora_customControls); fscanf(f, "custom_dpad=%d\n", &dummy); -// fscanf(f, "custom_up=%d\n", &customControlMap[SDLK_UP]); -// fscanf(f, "custom_down=%d\n", &customControlMap[SDLK_DOWN]); -// fscanf(f, "custom_left=%d\n", &customControlMap[SDLK_LEFT]); -// fscanf(f, "custom_right=%d\n", &customControlMap[SDLK_RIGHT]); -// fscanf(f, "custom_A=%d\n", &customControlMap[SDLK_HOME]); -// fscanf(f, "custom_B=%d\n", &customControlMap[SDLK_END]); -// fscanf(f, "custom_X=%d\n", &customControlMap[SDLK_PAGEDOWN]); -// fscanf(f, "custom_Y=%d\n", &customControlMap[SDLK_PAGEUP]); -// fscanf(f, "custom_L=%d\n", &customControlMap[SDLK_RSHIFT]); -// fscanf(f, "custom_R=%d\n", &customControlMap[SDLK_RCTRL]); + fscanf(f, "custom_up=%d\n", &customControlMap[SDLK_UP]); + fscanf(f, "custom_down=%d\n", &customControlMap[SDLK_DOWN]); + fscanf(f, "custom_left=%d\n", &customControlMap[SDLK_LEFT]); + fscanf(f, "custom_right=%d\n", &customControlMap[SDLK_RIGHT]); + fscanf(f, "custom_A=%d\n", &customControlMap[SDLK_HOME]); + fscanf(f, "custom_B=%d\n", &customControlMap[SDLK_END]); + fscanf(f, "custom_X=%d\n", &customControlMap[SDLK_PAGEDOWN]); + fscanf(f, "custom_Y=%d\n", &customControlMap[SDLK_PAGEUP]); + fscanf(f, "custom_L=%d\n", &customControlMap[SDLK_RSHIFT]); + fscanf(f, "custom_R=%d\n", &customControlMap[SDLK_RCTRL]); fscanf(f, "cpu=%d\n", &cpu_level); if (cpu_level > 0) // M68000 // Was old format diff --git a/src/od-pandora/neon_helper_p96.s b/src/od-pandora/neon_helper_p96.s new file mode 100644 index 00000000..39c696e7 --- /dev/null +++ b/src/od-pandora/neon_helper_p96.s @@ -0,0 +1,110 @@ +@ Some functions and tests to increase performance in drawing.cpp and custom.cpp + +.arm + +.global copy_screen_8bit +.global copy_screen_16bit_swap +.global copy_screen_32bit_to_16bit + +.text + +.align 8 + + +@---------------------------------------------------------------- +@ copy_screen_8bit +@ +@ r0: uae_u8 *dst +@ r1: uae_u8 *src +@ r2: int bytes always a multiple of 64: even number of lines, number of pixel per line is multiple of 32 (320, 640, 800, 1024, 1152, 1280) +@ r3: uae_u32 *clut +@ +@ void copy_screen_8bit(uae_u8 *dst, uae_u8 *src, int bytes, uae_u32 *clut); +@ +@---------------------------------------------------------------- +copy_screen_8bit: + stmdb sp!, {r4-r6, lr} +copy_screen_8bit_loop: + pld [r1, #192] + mov lr, #64 +copy_screen_8bit_loop_2: + ldr r4, [r1], #4 + and r5, r4, #255 + ldr r6, [r3, r5, lsl #2] + ubfx r5, r4, #8, #8 + strh r6, [r0], #2 + ldr r6, [r3, r5, lsl #2] + ubfx r5, r4, #16, #8 + strh r6, [r0], #2 + ldr r6, [r3, r5, lsl #2] + ubfx r5, r4, #24, #8 + strh r6, [r0], #2 + ldr r6, [r3, r5, lsl #2] + subs lr, lr, #4 + strh r6, [r0], #2 + bgt copy_screen_8bit_loop_2 + subs r2, r2, #64 + bgt copy_screen_8bit_loop + ldmia sp!, {r4-r6, pc} + + +@---------------------------------------------------------------- +@ copy_screen_16bit_swap +@ +@ r0: uae_u8 *dst +@ r1: uae_u8 *src +@ r2: int bytes always a multiple of 128: even number of lines, 2 bytes per pixel, number of pixel per line is multiple of 32 (320, 640, 800, 1024, 1152, 1280) +@ +@ void copy_screen_16bit_swap(uae_u8 *dst, uae_u8 *src, int bytes); +@ +@---------------------------------------------------------------- +copy_screen_16bit_swap: + pld [r1, #192] + vldmia r1!, {q8, q9} + vrev16.8 q8, q8 + vldmia r1!, {q10} + vrev16.8 q9, q9 + vldmia r1!, {q11} + vrev16.8 q10, q10 + vldmia r1!, {q12} + vrev16.8 q11, q11 + vldmia r1!, {q13} + vrev16.8 q12, q12 + vldmia r1!, {q14} + vrev16.8 q13, q13 + vldmia r1!, {q15} + vrev16.8 q14, q14 + vrev16.8 q15, q15 + subs r2, r2, #128 @ we handle 16 * 8 bytes per loop + vstmia r0!, {q8-q15} + bne copy_screen_16bit_swap + bx lr + + +@---------------------------------------------------------------- +@ copy_screen_32bit_to_16bit_neon +@ +@ r0: uae_u8 *dst - Format (bits): rrrr rggg gggb bbbb +@ r1: uae_u8 *src - Format (bytes) in memory rgba +@ r2: int bytes +@ +@ void copy_screen_32bit_to_16bit(uae_u8 *dst, uae_u8 *src, int bytes); +@ +@---------------------------------------------------------------- +copy_screen_32bit_to_16bit_neon: + pld [r1, #192] + vld4.8 {d18-d21}, [r1]! + vld4.8 {d22-d25}, [r1]! + vswp d19, d22 + vswp d21, d24 @ -> q9=r, q10=b, q11=g, q12=a + vsri.i8 q9, q11, #5 @ q9: rrrr rggg + vshr.u8 q8, q10, #3 @ q8: 000b bbbb + vshr.u8 q11, q11, #2 @ q11: 00gg gggg + vsli.i8 q8, q11, #5 @ q8: gggb bbbb + vswp d17, d18 + subs r2, r2, #64 @ processd 4 (bytes per pixel) * 16 (pixel) + vst2.8 {d16-d17}, [r0]! + vst2.8 {d18-d19}, [r0]! + bne copy_screen_32bit_to_16bit_neon + bx lr + diff --git a/src/od-pandora/pandora.cpp b/src/od-pandora/pandora.cpp index f1f1fd99..f6436b16 100644 --- a/src/od-pandora/pandora.cpp +++ b/src/od-pandora/pandora.cpp @@ -54,7 +54,7 @@ extern int loadconfig_old(struct uae_prefs *p, const char *orgpath); extern void SetLastActiveConfig(const char *filename); /* Keyboard */ -//int customControlMap[SDLK_LAST]; +int customControlMap[SDLK_LAST]; char start_path_data[MAX_DPATH]; char currentDir[MAX_DPATH]; @@ -261,7 +261,7 @@ void target_default_options (struct uae_prefs *p, int type) p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5 | RGBFF_R8G8B8A8; -// memset(customControlMap, 0, sizeof(customControlMap)); + memset(customControlMap, 0, sizeof(customControlMap)); } @@ -271,16 +271,16 @@ void target_save_options (struct zfile *f, struct uae_prefs *p) cfgfile_write (f, "pandora.hide_idle_led", "%d", p->pandora_hide_idle_led); cfgfile_write (f, "pandora.tap_delay", "%d", p->pandora_tapDelay); cfgfile_write (f, "pandora.custom_controls", "%d", p->pandora_customControls); -// cfgfile_write (f, "pandora.custom_up", "%d", customControlMap[SDLK_UP]); -// cfgfile_write (f, "pandora.custom_down", "%d", customControlMap[SDLK_DOWN]); -// cfgfile_write (f, "pandora.custom_left", "%d", customControlMap[SDLK_LEFT]); -// cfgfile_write (f, "pandora.custom_right", "%d", customControlMap[SDLK_RIGHT]); -// cfgfile_write (f, "pandora.custom_a", "%d", customControlMap[SDLK_HOME]); -// cfgfile_write (f, "pandora.custom_b", "%d", customControlMap[SDLK_END]); -// cfgfile_write (f, "pandora.custom_x", "%d", customControlMap[SDLK_PAGEDOWN]); -// cfgfile_write (f, "pandora.custom_y", "%d", customControlMap[SDLK_PAGEUP]); -// cfgfile_write (f, "pandora.custom_l", "%d", customControlMap[SDLK_RSHIFT]); -// cfgfile_write (f, "pandora.custom_r", "%d", customControlMap[SDLK_RCTRL]); + cfgfile_write (f, "pandora.custom_up", "%d", customControlMap[SDLK_UP]); + cfgfile_write (f, "pandora.custom_down", "%d", customControlMap[SDLK_DOWN]); + cfgfile_write (f, "pandora.custom_left", "%d", customControlMap[SDLK_LEFT]); + cfgfile_write (f, "pandora.custom_right", "%d", customControlMap[SDLK_RIGHT]); + cfgfile_write (f, "pandora.custom_a", "%d", customControlMap[SDLK_HOME]); + cfgfile_write (f, "pandora.custom_b", "%d", customControlMap[SDLK_END]); + cfgfile_write (f, "pandora.custom_x", "%d", customControlMap[SDLK_PAGEDOWN]); + cfgfile_write (f, "pandora.custom_y", "%d", customControlMap[SDLK_PAGEUP]); + cfgfile_write (f, "pandora.custom_l", "%d", customControlMap[SDLK_RSHIFT]); + cfgfile_write (f, "pandora.custom_r", "%d", customControlMap[SDLK_RCTRL]); cfgfile_write (f, "pandora.move_x", "%d", p->pandora_horizontal_offset); cfgfile_write (f, "pandora.move_y", "%d", p->pandora_vertical_offset); } @@ -302,16 +302,16 @@ int target_parse_option (struct uae_prefs *p, const char *option, const char *va || cfgfile_intval (option, value, "hide_idle_led", &p->pandora_hide_idle_led, 1) || cfgfile_intval (option, value, "tap_delay", &p->pandora_tapDelay, 1) || cfgfile_intval (option, value, "custom_controls", &p->pandora_customControls, 1) -// || cfgfile_intval (option, value, "custom_up", &customControlMap[SDLK_UP], 1) -// || cfgfile_intval (option, value, "custom_down", &customControlMap[SDLK_DOWN], 1) -// || cfgfile_intval (option, value, "custom_left", &customControlMap[SDLK_LEFT], 1) -// || cfgfile_intval (option, value, "custom_right", &customControlMap[SDLK_RIGHT], 1) -// || cfgfile_intval (option, value, "custom_a", &customControlMap[SDLK_HOME], 1) -// || cfgfile_intval (option, value, "custom_b", &customControlMap[SDLK_END], 1) -// || cfgfile_intval (option, value, "custom_x", &customControlMap[SDLK_PAGEDOWN], 1) -// || cfgfile_intval (option, value, "custom_y", &customControlMap[SDLK_PAGEUP], 1) -// || cfgfile_intval (option, value, "custom_l", &customControlMap[SDLK_RSHIFT], 1) -// || cfgfile_intval (option, value, "custom_r", &customControlMap[SDLK_RCTRL], 1) + || cfgfile_intval (option, value, "custom_up", &customControlMap[SDLK_UP], 1) + || cfgfile_intval (option, value, "custom_down", &customControlMap[SDLK_DOWN], 1) + || cfgfile_intval (option, value, "custom_left", &customControlMap[SDLK_LEFT], 1) + || cfgfile_intval (option, value, "custom_right", &customControlMap[SDLK_RIGHT], 1) + || cfgfile_intval (option, value, "custom_a", &customControlMap[SDLK_HOME], 1) + || cfgfile_intval (option, value, "custom_b", &customControlMap[SDLK_END], 1) + || cfgfile_intval (option, value, "custom_x", &customControlMap[SDLK_PAGEDOWN], 1) + || cfgfile_intval (option, value, "custom_y", &customControlMap[SDLK_PAGEUP], 1) + || cfgfile_intval (option, value, "custom_l", &customControlMap[SDLK_RSHIFT], 1) + || cfgfile_intval (option, value, "custom_r", &customControlMap[SDLK_RCTRL], 1) || cfgfile_intval (option, value, "move_x", &p->pandora_horizontal_offset, 1) || cfgfile_intval (option, value, "move_y", &p->pandora_vertical_offset, 1) ); @@ -916,23 +916,23 @@ int handle_msgpump (void) // Fall through... default: -// if(currprefs.pandora_customControls) -// { -// keycode = customControlMap[rEvent.key.keysym.sym]; -// if(keycode < 0) -// { -// // Simulate mouse or joystick -// SimulateMouseOrJoy(keycode, 1); -// break; -// } -// else if(keycode > 0) -// { -// // Send mapped key press -// inputdevice_do_keyboard(keycode, 1); -// break; -// } -// } -// else + if(currprefs.pandora_customControls) + { + keycode = customControlMap[rEvent.key.keysym.sym]; + if(keycode < 0) + { + // Simulate mouse or joystick + SimulateMouseOrJoy(keycode, 1); + break; + } + else if(keycode > 0) + { + // Send mapped key press + inputdevice_do_keyboard(keycode, 1); + break; + } + } + else modifier = rEvent.key.keysym.mod; keycode = translate_pandora_keys(rEvent.key.keysym.sym, &modifier); @@ -995,22 +995,22 @@ int handle_msgpump (void) // Fall through... default: -// if(currprefs.pandora_customControls) -// { -// keycode = customControlMap[rEvent.key.keysym.sym]; -// if(keycode < 0) -// { -// // Simulate mouse or joystick -// SimulateMouseOrJoy(keycode, 0); -// break; -// } -// else if(keycode > 0) -// { -// // Send mapped key release -// inputdevice_do_keyboard(keycode, 0); -// break; -// } -// } + if(currprefs.pandora_customControls) + { + keycode = customControlMap[rEvent.key.keysym.sym]; + if(keycode < 0) + { + // Simulate mouse or joystick + SimulateMouseOrJoy(keycode, 0); + break; + } + else if(keycode > 0) + { + // Send mapped key release + inputdevice_do_keyboard(keycode, 0); + break; + } + } modifier = rEvent.key.keysym.mod; keycode = translate_pandora_keys(rEvent.key.keysym.sym, &modifier); diff --git a/src/od-pandora/pandora_gfx.cpp b/src/od-pandora/pandora_gfx.cpp index bf2f0a9d..51f102b1 100644 --- a/src/od-pandora/pandora_gfx.cpp +++ b/src/od-pandora/pandora_gfx.cpp @@ -12,16 +12,14 @@ #include "inputdevice.h" #include "savestate.h" #include "picasso96.h" -#include "pandora_gfx.h" #include #include -#include -//#ifndef ANDROID -//#include -//#endif -#include -#include +#include +#ifndef ANDROID +#include +#endif +#include #ifdef ANDROID #include @@ -34,21 +32,17 @@ #include #include -//#ifndef OMAPFB_WAITFORVSYNC -//#define OMAPFB_WAITFORVSYNC _IOW('F', 0x20, unsigned int) -//#endif -//#ifndef OMAPFB_WAITFORVSYNC_FRAME -//#define OMAPFB_WAITFORVSYNC_FRAME _IOWR('O', 70, unsigned int) -//#endif +#ifndef OMAPFB_WAITFORVSYNC +#define OMAPFB_WAITFORVSYNC _IOW('F', 0x20, unsigned int) +#endif +#ifndef OMAPFB_WAITFORVSYNC_FRAME +#define OMAPFB_WAITFORVSYNC_FRAME _IOWR('O', 70, unsigned int) +#endif /* SDL variable for output of emulation */ -//SDL_Window* amigaWindow = NULL; -//SDL_Renderer* amigaRenderer = NULL; -//SDL_Texture *amigaTexture = NULL; -SDL_Surface *amigaSurface = NULL; - -//static int fbdev = -1; -//static unsigned int current_vsync_frame = 0; +SDL_Surface *prSDLScreen = NULL; +static int fbdev = -1; +static unsigned int current_vsync_frame = 0; /* Possible screen modes (x and y resolutions) */ @@ -75,12 +69,12 @@ static void CreateScreenshot(void); static int save_thumb(char *path); int delay_savestate_frame = 0; -//#define VIDEO_FLAGS_INIT SDL_SWSURFACE|SDL_FULLSCREEN -//#ifdef ANDROIDSDL -//#define VIDEO_FLAGS VIDEO_FLAGS_INIT -//#else -//#define VIDEO_FLAGS VIDEO_FLAGS_INIT | SDL_DOUBLEBUF -//#endif +#define VIDEO_FLAGS_INIT SDL_SWSURFACE|SDL_FULLSCREEN +#ifdef ANDROIDSDL +#define VIDEO_FLAGS VIDEO_FLAGS_INIT +#else +#define VIDEO_FLAGS VIDEO_FLAGS_INIT | SDL_DOUBLEBUF +#endif static unsigned long next_synctime = 0; @@ -147,132 +141,122 @@ void InitAmigaVidMode(struct uae_prefs *p) { /* Initialize structure for Amiga video modes */ gfxvidinfo.pixbytes = 2; - gfxvidinfo.bufmem = (uae_u8 *)amigaSurface->pixels; + gfxvidinfo.bufmem = (uae_u8 *)prSDLScreen->pixels; gfxvidinfo.outwidth = p->gfx_size.width; gfxvidinfo.outheight = p->gfx_size.height; - gfxvidinfo.rowbytes = amigaSurface->pitch; + gfxvidinfo.rowbytes = prSDLScreen->pitch; } void graphics_subshutdown (void) { - if (amigaSurface != NULL) + if(prSDLScreen != NULL) { - SDL_FreeSurface(amigaSurface); - amigaSurface = NULL; + SDL_FreeSurface(prSDLScreen); + prSDLScreen = NULL; + } + if(fbdev != -1) + { + close(fbdev); + fbdev = -1; } - -// if (texture != NULL) -// { -// SDL_DestroyTexture(texture); -// texture = NULL; -// } } -// -//static void CalcPandoraWidth(struct uae_prefs *p) -//{ -// int amigaWidth = p->gfx_size.width; -// int amigaHeight = p->gfx_size.height; -// int pandHeight = 480; -// -// p->gfx_resolution = p->gfx_size.width > 600 ? 1 : 0; -// if(amigaWidth > 600) -// amigaWidth = amigaWidth / 2; // Hires selected, but we calc in lores -// int pandWidth = (amigaWidth * pandHeight) / amigaHeight; -// pandWidth = pandWidth & (~1); -// if((pandWidth * amigaHeight) / pandHeight < amigaWidth) -// pandWidth += 2; -// if(pandWidth > 800) -// pandWidth = 800; -// p->gfx_size_fs.width = pandWidth; -//} + +static void CalcPandoraWidth(struct uae_prefs *p) +{ + int amigaWidth = p->gfx_size.width; + int amigaHeight = p->gfx_size.height; + int pandHeight = 480; + + p->gfx_resolution = p->gfx_size.width > 600 ? 1 : 0; + if(amigaWidth > 600) + amigaWidth = amigaWidth / 2; // Hires selected, but we calc in lores + int pandWidth = (amigaWidth * pandHeight) / amigaHeight; + pandWidth = pandWidth & (~1); + if((pandWidth * amigaHeight) / pandHeight < amigaWidth) + pandWidth += 2; + if(pandWidth > 800) + pandWidth = 800; + p->gfx_size_fs.width = pandWidth; +} + static void open_screen(struct uae_prefs *p) { + char layersize[20]; + graphics_subshutdown(); + if(!screen_is_picasso) + { + CalcPandoraWidth(p); + + snprintf(layersize, 20, "%dx480", p->gfx_size_fs.width); +#ifndef WIN32 + setenv("SDL_OMAP_LAYER_SIZE", layersize, 1); +#endif + } + else + { + if(picasso_vidinfo.height < 480) + snprintf(layersize, 20, "%dx480", picasso_vidinfo.width); + else + snprintf(layersize, 20, "%dx%d", picasso_vidinfo.width, picasso_vidinfo.height); +#ifndef WIN32 + setenv("SDL_OMAP_LAYER_SIZE", layersize, 1); +#endif + } +#ifndef WIN32 + setenv("SDL_OMAP_VSYNC", "0", 1); +#endif + #ifdef ANDROIDSDL update_onscreen(); #endif if(!screen_is_picasso) { - if (amigaSurface == NULL || amigaSurface->w != p->gfx_size.width || amigaSurface->h != p->gfx_size.height) - { - amigaSurface = SDL_CreateRGBSurface(0, p->gfx_size.width, p->gfx_size.height, 32, 0, 0, 0, 0); - check_error_sdl(amigaSurface == nullptr, "Unable to create a surface"); - - // make the scaled rendering look smoother. - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); - SDL_RenderSetLogicalSize(renderer, p->gfx_size.width, p->gfx_size.height); - - // Initialize SDL Texture for the renderer -// if (texture == nullptr) - { - texture = SDL_CreateTexture(renderer, - SDL_PIXELFORMAT_ARGB8888, - SDL_TEXTUREACCESS_STREAMING, - p->gfx_size.width, - p->gfx_size.height); - check_error_sdl(texture == nullptr, "Unable to create texture"); - } - } + if(prSDLScreen == NULL || prSDLScreen->w != p->gfx_size.width || prSDLScreen->h != p->gfx_size.height) + { +#if defined(PANDORA) && !defined(WIN32) + prSDLScreen = SDL_SetVideoMode(p->gfx_size.width, p->gfx_size.height, 16, SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF); +#elif defined(PANDORA) && defined(WIN32) + prSDLScreen = SDL_SetVideoMode(p->gfx_size.width, p->gfx_size.height, 16, SDL_SWSURFACE|SDL_DOUBLEBUF); +#else + prSDLScreen = SDL_SetVideoMode(p->gfx_size.width, p->gfx_size.height, 16, SDL_HWSURFACE|SDL_FULLSCREEN); +#endif + } } else { - if (amigaSurface == NULL || amigaSurface->w != picasso_vidinfo.width || amigaSurface->h != picasso_vidinfo.height) - { - amigaSurface = SDL_CreateRGBSurface(0, picasso_vidinfo.width, picasso_vidinfo.height, 32, 0, 0, 0, 0); - check_error_sdl(amigaSurface == nullptr, "Unable to create a surface"); - - // make the scaled rendering look smoother. - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); - SDL_RenderSetLogicalSize(renderer, picasso_vidinfo.width, picasso_vidinfo.height); - - // Initialize SDL Texture for the renderer -// if (texture == nullptr) - { - texture = SDL_CreateTexture(renderer, - SDL_PIXELFORMAT_ARGB8888, - SDL_TEXTUREACCESS_STREAMING, - picasso_vidinfo.width, - picasso_vidinfo.height); - check_error_sdl(texture == nullptr, "Unable to create texture"); - } - } + prSDLScreen = SDL_SetVideoMode(picasso_vidinfo.width, picasso_vidinfo.height, 16, SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF); } - - if (amigaSurface != NULL) + if(prSDLScreen != NULL) { InitAmigaVidMode(p); init_row_map(); } - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, amigaSurface->pixels, amigaSurface->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); - -// current_vsync_frame = 0; -// fbdev = open("/dev/fb0", O_RDWR); -// if(fbdev != -1) -// { -// // Check if we have vsync with frame counter... -// current_vsync_frame = 0; -// ioctl(fbdev, OMAPFB_WAITFORVSYNC_FRAME, ¤t_vsync_frame); -// if(current_vsync_frame != 0) -// current_vsync_frame += 2; -// } + current_vsync_frame = 0; + fbdev = open("/dev/fb0", O_RDWR); + if(fbdev != -1) + { + // Check if we have vsync with frame counter... + current_vsync_frame = 0; + ioctl(fbdev, OMAPFB_WAITFORVSYNC_FRAME, ¤t_vsync_frame); + if(current_vsync_frame != 0) + current_vsync_frame += 2; + } } void update_display(struct uae_prefs *p) { open_screen(p); + SDL_ShowCursor(SDL_DISABLE); + framecnt = 1; // Don't draw frame before reset done } @@ -318,24 +302,24 @@ int check_prefs_changed_gfx (void) int lockscr (void) { - SDL_LockSurface(amigaSurface); + SDL_LockSurface(prSDLScreen); return 1; } void unlockscr (void) { - SDL_UnlockSurface(amigaSurface); + SDL_UnlockSurface(prSDLScreen); } void wait_for_vsync(void) { -// if(fbdev != -1) -// { -// unsigned int dummy; -// ioctl(fbdev, OMAPFB_WAITFORVSYNC, &dummy); -// } + if(fbdev != -1) + { + unsigned int dummy; + ioctl(fbdev, OMAPFB_WAITFORVSYNC, &dummy); + } } @@ -358,45 +342,37 @@ void flush_screen () #endif unsigned long start = read_processor_time(); -// if(current_vsync_frame == 0) -// { -// // Old style for vsync and idle time calc -// if(start < next_synctime && next_synctime - start > time_per_frame - 1000) -// usleep((next_synctime - start) - 750); -// ioctl(fbdev, OMAPFB_WAITFORVSYNC, ¤t_vsync_frame); -// } -// else -// { -// // New style for vsync and idle time calc -// int wait_till = current_vsync_frame; -// do -// { -// ioctl(fbdev, OMAPFB_WAITFORVSYNC_FRAME, ¤t_vsync_frame); -// } -// while (wait_till >= current_vsync_frame); -// -// if(wait_till + 1 != current_vsync_frame) -// { -// // We missed a vsync... -// next_synctime = 0; -// } -// current_vsync_frame += currprefs.gfx_framerate; -// } + if(current_vsync_frame == 0) + { + // Old style for vsync and idle time calc + if(start < next_synctime && next_synctime - start > time_per_frame - 1000) + usleep((next_synctime - start) - 750); + ioctl(fbdev, OMAPFB_WAITFORVSYNC, ¤t_vsync_frame); + } + else + { + // New style for vsync and idle time calc + int wait_till = current_vsync_frame; + do + { + ioctl(fbdev, OMAPFB_WAITFORVSYNC_FRAME, ¤t_vsync_frame); + } + while (wait_till >= current_vsync_frame); + + if(wait_till + 1 != current_vsync_frame) + { + // We missed a vsync... + next_synctime = 0; + } + current_vsync_frame += currprefs.gfx_framerate; + } // Android swapped SDL_Flip & last_synctime for fixing performance -// SDL_Flip(prSDLScreen); + SDL_Flip(prSDLScreen); + last_synctime = read_processor_time(); - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, amigaSurface->pixels, amigaSurface->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); - - last_synctime = read_processor_time(); - if(!screen_is_picasso) - gfxvidinfo.bufmem = (uae_u8 *)amigaSurface->pixels; + gfxvidinfo.bufmem = (uae_u8 *)prSDLScreen->pixels; if(last_synctime - next_synctime > time_per_frame * (1 + currprefs.gfx_framerate) - 1000 || next_synctime < start) adjust_idletime(0); @@ -414,38 +390,25 @@ void flush_screen () void black_screen_now(void) { - SDL_FillRect(amigaSurface, NULL, 0); -// SDL_Flip(prSDLScreen); - - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, amigaSurface->pixels, amigaSurface->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); + SDL_FillRect(prSDLScreen,NULL,0); + SDL_Flip(prSDLScreen); } static void graphics_subinit (void) { - if (amigaSurface == NULL) - { - fprintf(stderr, "Unable to set video mode: %s\n", SDL_GetError()); - return; - } - else - { - // Update the texture from the surface - SDL_UpdateTexture(texture, NULL, amigaSurface->pixels, amigaSurface->pitch); - // Copy the texture on the renderer - SDL_RenderCopy(renderer, texture, NULL, NULL); - // Update the window surface (show the renderer) - SDL_RenderPresent(renderer); - - SDL_ShowCursor(SDL_DISABLE); - InitAmigaVidMode(&currprefs); - } - + if (prSDLScreen == NULL) + { + fprintf(stderr, "Unable to set video mode: %s\n", SDL_GetError()); + return; + } + else + { + SDL_Flip(prSDLScreen); + SDL_ShowCursor(SDL_DISABLE); + + InitAmigaVidMode(&currprefs); + } } STATIC_INLINE int bitsInMask (unsigned long mask) @@ -481,12 +444,12 @@ static int init_colors (void) int red_shift, green_shift, blue_shift; /* Truecolor: */ - red_bits = bitsInMask(amigaSurface->format->Rmask); - green_bits = bitsInMask(amigaSurface->format->Gmask); - blue_bits = bitsInMask(amigaSurface->format->Bmask); - red_shift = maskShift(amigaSurface->format->Rmask); - green_shift = maskShift(amigaSurface->format->Gmask); - blue_shift = maskShift(amigaSurface->format->Bmask); + red_bits = bitsInMask(prSDLScreen->format->Rmask); + green_bits = bitsInMask(prSDLScreen->format->Gmask); + blue_bits = bitsInMask(prSDLScreen->format->Bmask); + red_shift = maskShift(prSDLScreen->format->Rmask); + green_shift = maskShift(prSDLScreen->format->Gmask); + blue_shift = maskShift(prSDLScreen->format->Bmask); alloc_colors64k (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, 0); notice_new_xcolors(); for (i = 0; i < 4096; i++) @@ -501,19 +464,19 @@ static int init_colors (void) */ static int get_display_depth (void) { -// const SDL_VideoInfo *vid_info; - int depth = 32; + const SDL_VideoInfo *vid_info; + int depth = 0; -// if ((vid_info = SDL_GetVideoInfo())) -// { -// depth = vid_info->vfmt->BitsPerPixel; -// -// /* Don't trust the answer if it's 16 bits; the display -// * could actually be 15 bits deep. We'll count the bits -// * ourselves */ -// if (depth == 16) -// depth = bitsInMask (vid_info->vfmt->Rmask) + bitsInMask (vid_info->vfmt->Gmask) + bitsInMask (vid_info->vfmt->Bmask); -// } + if ((vid_info = SDL_GetVideoInfo())) + { + depth = vid_info->vfmt->BitsPerPixel; + + /* Don't trust the answer if it's 16 bits; the display + * could actually be 15 bits deep. We'll count the bits + * ourselves */ + if (depth == 16) + depth = bitsInMask (vid_info->vfmt->Rmask) + bitsInMask (vid_info->vfmt->Gmask) + bitsInMask (vid_info->vfmt->Bmask); + } return depth; } @@ -545,18 +508,16 @@ int graphics_init (bool mousecapture) void graphics_leave (void) { graphics_subshutdown (); - SDL_DestroyRenderer(renderer); - SDL_DestroyWindow(sdlWindow); SDL_VideoQuit(); } -#define systemRedShift (amigaSurface->format->Rshift) -#define systemGreenShift (amigaSurface->format->Gshift) -#define systemBlueShift (amigaSurface->format->Bshift) -#define systemRedMask (amigaSurface->format->Rmask) -#define systemGreenMask (amigaSurface->format->Gmask) -#define systemBlueMask (amigaSurface->format->Bmask) +#define systemRedShift (prSDLScreen->format->Rshift) +#define systemGreenShift (prSDLScreen->format->Gshift) +#define systemBlueShift (prSDLScreen->format->Bshift) +#define systemRedMask (prSDLScreen->format->Rmask) +#define systemGreenMask (prSDLScreen->format->Gmask) +#define systemBlueMask (prSDLScreen->format->Bmask) static int save_png(SDL_Surface* surface, char *path) { @@ -641,17 +602,10 @@ static void CreateScreenshot(void) current_screenshot = NULL; } - w = amigaSurface->w; - h = amigaSurface->h; - current_screenshot = SDL_CreateRGBSurfaceFrom(amigaSurface->pixels, - w, - h, - amigaSurface->format->BitsPerPixel, - amigaSurface->pitch, - amigaSurface->format->Rmask, - amigaSurface->format->Gmask, - amigaSurface->format->Bmask, - amigaSurface->format->Amask); + w=prSDLScreen->w; + h=prSDLScreen->h; + current_screenshot = SDL_CreateRGBSurfaceFrom(prSDLScreen->pixels, w, h, prSDLScreen->format->BitsPerPixel, prSDLScreen->pitch, + prSDLScreen->format->Rmask, prSDLScreen->format->Gmask, prSDLScreen->format->Bmask, prSDLScreen->format->Amask); } @@ -670,6 +624,7 @@ static int save_thumb(char *path) #ifdef PICASSO96 + int picasso_palette (void) { int i, changed; @@ -774,17 +729,20 @@ void picasso_InitResolutions (void) int pixelFormat = 1 << rgbFormat; pixelFormat |= RGBFF_CHUNKY; - DisplayModes[count].res.width = x_size_table[i]; - DisplayModes[count].res.height = y_size_table[i]; - DisplayModes[count].depth = bit_unit >> 3; - DisplayModes[count].refresh[0] = 50; - DisplayModes[count].refresh[1] = 60; - DisplayModes[count].refresh[2] = 0; - DisplayModes[count].colormodes = pixelFormat; - sprintf(DisplayModes[count].name, "%dx%d, %d-bit", - DisplayModes[count].res.width, DisplayModes[count].res.height, DisplayModes[count].depth * 8); + if (SDL_VideoModeOK (x_size_table[i], y_size_table[i], 16, SDL_SWSURFACE)) + { + DisplayModes[count].res.width = x_size_table[i]; + DisplayModes[count].res.height = y_size_table[i]; + DisplayModes[count].depth = bit_unit >> 3; + DisplayModes[count].refresh[0] = 50; + DisplayModes[count].refresh[1] = 60; + DisplayModes[count].refresh[2] = 0; + DisplayModes[count].colormodes = pixelFormat; + sprintf(DisplayModes[count].name, "%dx%d, %d-bit", + DisplayModes[count].res.width, DisplayModes[count].res.height, DisplayModes[count].depth * 8); - count++; + count++; + } } } DisplayModes[count].depth = -1; @@ -891,7 +849,7 @@ void gfx_set_picasso_state (int on) screen_is_picasso = on; open_screen(&currprefs); - picasso_vidinfo.rowbytes = amigaSurface->pitch; + picasso_vidinfo.rowbytes = prSDLScreen->pitch; } void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt) @@ -913,21 +871,21 @@ void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgb if (screen_is_picasso) { open_screen(&currprefs); - picasso_vidinfo.rowbytes = amigaSurface->pitch; - picasso_vidinfo.rgbformat = RGBFB_R8G8B8A8; + picasso_vidinfo.rowbytes = prSDLScreen->pitch; + picasso_vidinfo.rgbformat = RGBFB_R5G6B5; } } uae_u8 *gfx_lock_picasso (void) { - SDL_LockSurface(amigaSurface); - picasso_vidinfo.rowbytes = amigaSurface->pitch; - return (uae_u8 *)amigaSurface->pixels; + SDL_LockSurface(prSDLScreen); + picasso_vidinfo.rowbytes = prSDLScreen->pitch; + return (uae_u8 *)prSDLScreen->pixels; } void gfx_unlock_picasso (void) { - SDL_UnlockSurface(amigaSurface); + SDL_UnlockSurface(prSDLScreen); } #endif // PICASSO96 diff --git a/src/od-pandora/pandora_gfx.h b/src/od-pandora/pandora_gfx.h deleted file mode 100644 index 10a2d556..00000000 --- a/src/od-pandora/pandora_gfx.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef PANDORA_GFX_H -#define PANDORA_GFX_H - -extern SDL_Window* sdlWindow; -extern SDL_Renderer* renderer; -extern SDL_Texture *texture; -extern SDL_Surface *amigaSurface; - -extern void check_error_sdl(bool check, const char* message); -#endif diff --git a/src/od-pandora/pandora_gui.cpp b/src/od-pandora/pandora_gui.cpp index b08ba057..b37957fe 100644 --- a/src/od-pandora/pandora_gui.cpp +++ b/src/od-pandora/pandora_gui.cpp @@ -604,9 +604,9 @@ void moveVertical(int value) void gui_handle_events(void) { - const Uint8 *keystate = SDL_GetKeyboardState(NULL); + Uint8 *keystate = SDL_GetKeyState(NULL); - if (keystate[SDLK_LCTRL] && keystate[SDLK_LGUI] && (keystate[SDLK_RGUI] || keystate[SDLK_MENU])) + if (keystate[SDLK_LCTRL] && keystate[SDLK_LSUPER] && (keystate[SDLK_RSUPER] || keystate[SDLK_MENU])) uae_reset(0, 1); } diff --git a/src/od-pandora/pandora_input.cpp b/src/od-pandora/pandora_input.cpp index 7fa14a3d..29117742 100644 --- a/src/od-pandora/pandora_input.cpp +++ b/src/od-pandora/pandora_input.cpp @@ -115,7 +115,7 @@ static void read_mouse(void) if (currprefs.jports[0].id == JSEM_MICE + 1 || currprefs.jports[1].id == JSEM_MICE + 1) { // dPad is mouse - const Uint8 *keystate = SDL_GetKeyboardState(NULL); + Uint8 *keystate = SDL_GetKeyState(NULL); int mouseScale = currprefs.input_joymouse_multiplier / 4; if (keystate[SDLK_LEFT]) @@ -301,7 +301,7 @@ static int init_joystick(void) for (int cpt; cpt < nr_joysticks; cpt++) { Joysticktable[cpt] = SDL_JoystickOpen(cpt); - strncpy(JoystickName[cpt], SDL_JoystickNameForIndex(cpt), 80); + strncpy(JoystickName[cpt], SDL_JoystickName(cpt), 80); printf("Joystick %i : %s\n", cpt, JoystickName[cpt]); printf(" Buttons: %i Axis: %i Hats: %i\n", SDL_JoystickNumButtons(Joysticktable[cpt]), SDL_JoystickNumAxes(Joysticktable[cpt]), SDL_JoystickNumHats(Joysticktable[cpt])); @@ -444,7 +444,7 @@ static void read_joystick(void) // First handle fake joystick from pandora... if (currprefs.jports[joyid].id == JSEM_JOYS) { - const Uint8 *keystate = SDL_GetKeyboardState(NULL); + Uint8 *keystate = SDL_GetKeyState(NULL); if (!keystate[SDLK_RCTRL]) { diff --git a/src/od-rasp/rasp_gfx.cpp b/src/od-rasp/rasp_gfx.cpp index f709a594..12fae782 100644 --- a/src/od-rasp/rasp_gfx.cpp +++ b/src/od-rasp/rasp_gfx.cpp @@ -16,17 +16,18 @@ #include #include #include -#include -//#include +#include #ifdef ANDROIDSDL #include #endif #include "td-sdl/thread.h" #include "bcm_host.h" -/* SDL surface variable for output of emulation */ -SDL_Surface *screenSurface = NULL; +/* SDL surface variable for output of emulation */ +SDL_Surface *prSDLScreen = NULL; +/* Dummy SDL variable for screen init */ +SDL_Surface *Dummy_prSDLScreen = NULL; static SDL_Surface *current_screenshot = NULL; /* Possible screen modes (x and y resolutions) */ @@ -41,7 +42,6 @@ struct PicassoResolution *DisplayModes; struct MultiDisplay Displays[MAX_DISPLAYS]; int screen_is_picasso = 0; -int result = 0; static int curr_layer_width = 0; @@ -61,35 +61,31 @@ int fcounter = 0; int doStylusRightClick = 0; int DispManXElementpresent = 0; -int width; -int height; static unsigned long previous_synctime = 0; static unsigned long next_synctime = 0; uae_sem_t vsync_wait_sem; -DISPMANX_DISPLAY_HANDLE_T display; -DISPMANX_MODEINFO_T info; -DISPMANX_RESOURCE_HANDLE_T bgResource; -DISPMANX_RESOURCE_HANDLE_T resource; -DISPMANX_ELEMENT_HANDLE_T element; -DISPMANX_ELEMENT_HANDLE_T bgElement; -DISPMANX_UPDATE_HANDLE_T update; -VC_IMAGE_TYPE_T type = VC_IMAGE_RGBA32; +DISPMANX_DISPLAY_HANDLE_T dispmanxdisplay; +DISPMANX_MODEINFO_T dispmanxdinfo; +DISPMANX_RESOURCE_HANDLE_T dispmanxresource_amigafb_1; +DISPMANX_RESOURCE_HANDLE_T dispmanxresource_amigafb_2; +DISPMANX_ELEMENT_HANDLE_T dispmanxelement; +DISPMANX_UPDATE_HANDLE_T dispmanxupdate; VC_RECT_T src_rect; VC_RECT_T dst_rect; VC_RECT_T blit_rect; -VC_DISPMANX_ALPHA_T alpha = { - (DISPMANX_FLAGS_ALPHA_T)(DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS), - 255, /*alpha 0->255*/ - 0 -}; unsigned char current_resource_amigafb = 0; void vsync_callback(unsigned int a, void* b) { + //vsync_timing=SDL_GetTicks(); + //vsync_frequency = vsync_timing - old_time; + //old_time = vsync_timing; + //need_frameskip = ( vsync_frequency > 31 ) ? (need_frameskip+1) : need_frameskip; + //printf("d: %i", vsync_frequency ); uae_sem_post (&vsync_wait_sem); } @@ -107,7 +103,7 @@ void InitAmigaVidMode(struct uae_prefs *p) { /* Initialize structure for Amiga video modes */ gfxvidinfo.pixbytes = 2; - gfxvidinfo.bufmem = (uae_u8 *)screenSurface->pixels; + gfxvidinfo.bufmem = (uae_u8 *)prSDLScreen->pixels; gfxvidinfo.outwidth = p->gfx_size.width; gfxvidinfo.outheight = p->gfx_size.height; #ifdef PICASSO96 @@ -126,33 +122,31 @@ void graphics_dispmanshutdown (void) if (DispManXElementpresent == 1) { DispManXElementpresent = 0; - update = vc_dispmanx_update_start(0); - assert(update != 0); - result = vc_dispmanx_element_remove(update, element); - assert(result == 0); - result = vc_dispmanx_update_submit_sync(update); - assert(result == 0); - - result = vc_dispmanx_resource_delete(resource); - assert(result == 0); - result = vc_dispmanx_resource_delete(bgResource); - assert(result == 0); + dispmanxupdate = vc_dispmanx_update_start( 10 ); + vc_dispmanx_element_remove( dispmanxupdate, dispmanxelement); + vc_dispmanx_update_submit_sync(dispmanxupdate); } } void graphics_subshutdown (void) { - if (bgResource != 0) + if (dispmanxresource_amigafb_1 != 0) graphics_dispmanshutdown(); - - SDL_FreeSurface(screenSurface); - screenSurface = NULL; + // Dunno if below lines are usefull for Rpi... + //SDL_FreeSurface(prSDLScreen); + //prSDLScreen = NULL; } static void open_screen(struct uae_prefs *p) { - uint32_t displayNumber = 0; - uint32_t vc_image_ptr; + VC_DISPMANX_ALPHA_T alpha = { (DISPMANX_FLAGS_ALPHA_T ) (DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS), + 255, /*alpha 0->255*/ + 0 + }; + + uint32_t vc_image_ptr; + int width; + int height; #ifdef PICASSO96 if (screen_is_picasso) @@ -168,165 +162,128 @@ static void open_screen(struct uae_prefs *p) height = p->gfx_size.height; } - SDL_ShowCursor(SDL_DISABLE); + //if(prSDLScreen != NULL) + //{ + // SDL_FreeSurface(prSDLScreen); + // prSDLScreen = NULL; + //} - // check if resolution hasn't changed in menu, otherwise free the resources so that they will be re-generated with new resolution. - if ((bgResource != 0) && + if(Dummy_prSDLScreen == NULL ) + { + const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo (); + printf("DispmanX: Current resolution: %d x %d %d bpp\n",videoInfo->current_w, videoInfo->current_h, videoInfo->vfmt->BitsPerPixel); + // For debug, in order to avoid full screen. + Dummy_prSDLScreen = SDL_SetVideoMode(videoInfo->current_w,videoInfo->current_h, 16, SDL_SWSURFACE | SDL_FULLSCREEN); + //Dummy_prSDLScreen = SDL_SetVideoMode(800,480,16,SDL_SWSURFACE ); + } + + SDL_ShowCursor(SDL_DISABLE); + + // check if resolution hasn't change in menu. otherwise free the resources so that they will be re-generated with new resolution. + if ((dispmanxresource_amigafb_1 != 0) && ((blit_rect.width != width) || (blit_rect.height != height) || (currprefs.gfx_correct_aspect != changed_prefs.gfx_correct_aspect) || (currprefs.gfx_fullscreen_ratio != changed_prefs.gfx_fullscreen_ratio))) { -// printf("Emulation resolution change detected.\n"); - if(screenSurface != NULL ) + printf("Emulation resolution change detected.\n"); + if(prSDLScreen != NULL ) { - SDL_FreeSurface(screenSurface); - screenSurface = 0; + SDL_FreeSurface(prSDLScreen); + prSDLScreen = 0; } graphics_dispmanshutdown(); - bgResource = 0; - resource = 0; + vc_dispmanx_resource_delete( dispmanxresource_amigafb_1 ); + vc_dispmanx_resource_delete( dispmanxresource_amigafb_2 ); + dispmanxresource_amigafb_1 = 0; + dispmanxresource_amigafb_2 = 0; } - if (bgResource == 0) + if (dispmanxresource_amigafb_1 == 0) { - printf("Emulation resolution: Width %i Height: %i\n", width, height); + printf("Emulation resolution: Width %i Height: %i\n",width,height); currprefs.gfx_correct_aspect = changed_prefs.gfx_correct_aspect; currprefs.gfx_fullscreen_ratio = changed_prefs.gfx_fullscreen_ratio; - screenSurface = SDL_CreateRGBSurface(0, width, height, 32, 0, 0, 0, 0); + prSDLScreen = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 16, + Dummy_prSDLScreen->format->Rmask, + Dummy_prSDLScreen->format->Gmask, + Dummy_prSDLScreen->format->Bmask, + Dummy_prSDLScreen->format->Amask); - display = vc_dispmanx_display_open(displayNumber); - assert(display != 0); - result = vc_dispmanx_display_get_info(display, &info); - assert(result == 0); + dispmanxdisplay = vc_dispmanx_display_open( 0 ); + vc_dispmanx_display_get_info( dispmanxdisplay, &dispmanxdinfo); - bgResource = vc_dispmanx_resource_create(type, width, height, &vc_image_ptr); - assert(bgResource != 0); - resource = vc_dispmanx_resource_create(type, width, height, &vc_image_ptr); - assert(resource != 0); - -// vc_dispmanx_rect_set( &blit_rect, 0, 0, width, height); - vc_dispmanx_rect_set(&dst_rect, 0, 0, width, height); -// vc_dispmanx_resource_write_data(bgResource, type, sizeof(width), screenSurface->pixels, &blit_rect); - uint32_t background = 0; - result = vc_dispmanx_resource_write_data(bgResource, type, sizeof(background), &background, &dst_rect); - assert(result == 0); -// vc_dispmanx_rect_set(&src_rect, 0, 0, width << 16, height << 16); + dispmanxresource_amigafb_1 = vc_dispmanx_resource_create( VC_IMAGE_RGB565, width, height, &vc_image_ptr); + dispmanxresource_amigafb_2 = vc_dispmanx_resource_create( VC_IMAGE_RGB565, width, height, &vc_image_ptr); + vc_dispmanx_rect_set( &blit_rect, 0, 0, width,height); + vc_dispmanx_resource_write_data( dispmanxresource_amigafb_1, + VC_IMAGE_RGB565, + width *2, + prSDLScreen->pixels, + &blit_rect ); + vc_dispmanx_rect_set( &src_rect, 0, 0, width << 16, height << 16 ); } // 16/9 to 4/3 ratio adaptation. if (currprefs.gfx_correct_aspect == 0) { // Fullscreen. - int scaled_width = info.width * currprefs.gfx_fullscreen_ratio/100; - int scaled_height = info.height * currprefs.gfx_fullscreen_ratio/100; - vc_dispmanx_rect_set(&dst_rect, (info.width - scaled_width)/2, - (info.height - scaled_height)/2, + int scaled_width = dispmanxdinfo.width * currprefs.gfx_fullscreen_ratio/100; + int scaled_height = dispmanxdinfo.height * currprefs.gfx_fullscreen_ratio/100; + vc_dispmanx_rect_set( &dst_rect, (dispmanxdinfo.width - scaled_width)/2, + (dispmanxdinfo.height - scaled_height)/2, scaled_width, scaled_height ); } else { // 4/3 shrink. - int scaled_width = info.width * currprefs.gfx_fullscreen_ratio/100; - int scaled_height = info.height * currprefs.gfx_fullscreen_ratio/100; - vc_dispmanx_rect_set(&dst_rect, (info.width - scaled_width/16*12)/2, - (info.height - scaled_height)/2, + int scaled_width = dispmanxdinfo.width * currprefs.gfx_fullscreen_ratio/100; + int scaled_height = dispmanxdinfo.height * currprefs.gfx_fullscreen_ratio/100; + vc_dispmanx_rect_set( &dst_rect, (dispmanxdinfo.width - scaled_width/16*12)/2, + (dispmanxdinfo.height - scaled_height)/2, scaled_width/16*12, scaled_height ); } // For debug, in order to avoid full screen. - //vc_dispmanx_rect_set( &dst_rect, (info.width /2.7), + //vc_dispmanx_rect_set( &dst_rect, (dispmanxdinfo.width /2.7), // 0 , - // (info.width - (info.width * 6)/100 )/1.5, - // (info.height - (info.height * 7)/100 )/1.5); + // (dispmanxdinfo.width - (dispmanxdinfo.width * 6)/100 )/1.5, + // (dispmanxdinfo.height - (dispmanxdinfo.height * 7)/100 )/1.5); + - result = vc_dispmanx_resource_write_data(resource, - type, - 16 * sizeof(uint32_t), - screenSurface->pixels, - &dst_rect); - assert(result == 0); - if (DispManXElementpresent == 0) { DispManXElementpresent = 1; - update = vc_dispmanx_update_start(0); - assert(update != 0); - - bgElement = vc_dispmanx_element_add(update, - display, - 1, // layer - &dst_rect, - bgResource, - &src_rect, - DISPMANX_PROTECTION_NONE, - &alpha, - NULL, // clamp - DISPMANX_NO_ROTATE); - assert(bgElement != 0); - - vc_dispmanx_rect_set(&src_rect, 0, 0, width << 16, height << 16); - - element = vc_dispmanx_element_add(update, - display, - 2, // layer - &dst_rect, - resource, - &src_rect, - DISPMANX_PROTECTION_NONE, - &alpha, - NULL, // clamp - DISPMANX_NO_ROTATE); - assert(element != 0); + dispmanxupdate = vc_dispmanx_update_start( 10 ); + dispmanxelement = vc_dispmanx_element_add( dispmanxupdate, + dispmanxdisplay, + 2000, // layer + &dst_rect, + dispmanxresource_amigafb_1, + &src_rect, + DISPMANX_PROTECTION_NONE, + &alpha, + NULL, // clamp + DISPMANX_NO_ROTATE ); - result = vc_dispmanx_update_submit_sync(update); - assert(result == 0); + vc_dispmanx_update_submit(dispmanxupdate,NULL,NULL); + //dispmanxupdate = vc_dispmanx_update_start( 10 ); } - if(screenSurface != NULL) + if(prSDLScreen != NULL) { InitAmigaVidMode(p); init_row_map(); } -} - -void refresh_display(SDL_Surface* surface) -{ - //Write our Surface pixels to Dispmanx Resource - vc_dispmanx_rect_set(&dst_rect, 0, 0, width, height); - result = vc_dispmanx_resource_write_data(resource, - type, - 16 * sizeof(uint32_t), - surface->pixels, - &dst_rect); - assert(result == 0); - - //Start update - update = vc_dispmanx_update_start(0); - assert(update != 0); - - // Add element - element = vc_dispmanx_element_add(update, - display, - 1, // layer - &dst_rect, - resource, - &src_rect, - DISPMANX_PROTECTION_NONE, - &alpha, - NULL, // clamp - DISPMANX_NO_ROTATE); - assert(element != 0); - - //Update Display - result = vc_dispmanx_update_submit_sync(update); - assert(result == 0); + //framecnt = 1; // Don't draw frame before reset done } void update_display(struct uae_prefs *p) { open_screen(p); + SDL_ShowCursor(SDL_DISABLE); + framecnt = 1; // Don't draw frame before reset done } @@ -386,6 +343,14 @@ void wait_for_vsync(void) void flush_screen () { + //SDL_UnlockSurface (prSDLScreen); + + //if (show_inputmode) + //{ + // inputmode_redraw(); + //} + + if (savestate_state == STATE_DOSAVE) { if(delay_savestate_frame > 0) @@ -399,33 +364,38 @@ void flush_screen () } unsigned long start = read_processor_time(); + //if(start < next_synctime && next_synctime - start > time_per_frame - 1000) + // usleep((next_synctime - start) - 1000); + //SDL_Flip(prSDLScreen); + if (current_resource_amigafb == 1) { current_resource_amigafb = 0; - vc_dispmanx_resource_write_data(bgResource, - type, - sizeof(gfxvidinfo.outwidth), + vc_dispmanx_resource_write_data( dispmanxresource_amigafb_1, + VC_IMAGE_RGB565, + gfxvidinfo.outwidth * 2, gfxvidinfo.bufmem, &blit_rect ); - update = vc_dispmanx_update_start( 10 ); - vc_dispmanx_element_change_source(update, element, bgResource); + dispmanxupdate = vc_dispmanx_update_start( 10 ); + vc_dispmanx_element_change_source(dispmanxupdate,dispmanxelement,dispmanxresource_amigafb_1); + + vc_dispmanx_update_submit(dispmanxupdate,vsync_callback,NULL); + //vc_dispmanx_update_submit_sync(dispmanxupdate); -// vc_dispmanx_update_submit(update, vsync_callback, NULL); - vc_dispmanx_update_submit_sync(update); } else { current_resource_amigafb = 1; - vc_dispmanx_resource_write_data(resource, - type, - sizeof(gfxvidinfo.outwidth), + vc_dispmanx_resource_write_data( dispmanxresource_amigafb_2, + VC_IMAGE_RGB565, + gfxvidinfo.outwidth * 2, gfxvidinfo.bufmem, &blit_rect ); - update = vc_dispmanx_update_start( 10 ); - vc_dispmanx_element_change_source(update, element, resource); - vc_dispmanx_update_submit_sync(update); -// vc_dispmanx_update_submit(update, vsync_callback,NULL); + dispmanxupdate = vc_dispmanx_update_start( 10 ); + vc_dispmanx_element_change_source(dispmanxupdate,dispmanxelement,dispmanxresource_amigafb_2); + + vc_dispmanx_update_submit(dispmanxupdate,vsync_callback,NULL); } last_synctime = read_processor_time(); @@ -446,13 +416,13 @@ void flush_screen () void black_screen_now(void) { - SDL_FillRect(screenSurface, NULL, 0); - refresh_display(screenSurface); + SDL_FillRect(Dummy_prSDLScreen,NULL,0); + SDL_Flip(Dummy_prSDLScreen); } static void graphics_subinit (void) { - if (screenSurface == NULL) + if (prSDLScreen == NULL) { fprintf(stderr, "Unable to set video mode: %s\n", SDL_GetError()); return; @@ -460,6 +430,7 @@ static void graphics_subinit (void) else { SDL_ShowCursor(SDL_DISABLE); + InitAmigaVidMode(&currprefs); } } @@ -495,12 +466,12 @@ static int init_colors (void) int red_shift, green_shift, blue_shift; /* Truecolor: */ - red_bits = bitsInMask(screenSurface->format->Rmask); - green_bits = bitsInMask(screenSurface->format->Gmask); - blue_bits = bitsInMask(screenSurface->format->Bmask); - red_shift = maskShift(screenSurface->format->Rmask); - green_shift = maskShift(screenSurface->format->Gmask); - blue_shift = maskShift(screenSurface->format->Bmask); + red_bits = bitsInMask(prSDLScreen->format->Rmask); + green_bits = bitsInMask(prSDLScreen->format->Gmask); + blue_bits = bitsInMask(prSDLScreen->format->Bmask); + red_shift = maskShift(prSDLScreen->format->Rmask); + green_shift = maskShift(prSDLScreen->format->Gmask); + blue_shift = maskShift(prSDLScreen->format->Bmask); alloc_colors64k (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, 0); notice_new_xcolors(); for (i = 0; i < 4096; i++) @@ -514,19 +485,19 @@ static int init_colors (void) */ static int get_display_depth (void) { -// const SDL_VideoInfo *vid_info; - int depth = 32; + const SDL_VideoInfo *vid_info; + int depth = 0; -// if ((vid_info = SDL_GetVideoInfo())) -// { -// depth = vid_info->vfmt->BitsPerPixel; -// -// /* Don't trust the answer if it's 16 bits; the display -// * could actually be 15 bits deep. We'll count the bits -// * ourselves */ -// if (depth == 16) -// depth = bitsInMask (vid_info->vfmt->Rmask) + bitsInMask (vid_info->vfmt->Gmask) + bitsInMask (vid_info->vfmt->Bmask); -// } + if ((vid_info = SDL_GetVideoInfo())) + { + depth = vid_info->vfmt->BitsPerPixel; + + /* Don't trust the answer if it's 16 bits; the display + * could actually be 15 bits deep. We'll count the bits + * ourselves */ + if (depth == 16) + depth = bitsInMask (vid_info->vfmt->Rmask) + bitsInMask (vid_info->vfmt->Gmask) + bitsInMask (vid_info->vfmt->Bmask); + } return depth; } @@ -554,22 +525,26 @@ int graphics_init(bool mousecapture) if (!init_colors ()) return 0; + //buttonstate[0] = buttonstate[1] = buttonstate[2] = 0; + //keyboard_init(); + return 1; } void graphics_leave (void) { graphics_subshutdown (); + SDL_FreeSurface(Dummy_prSDLScreen); bcm_host_deinit(); - SDL_VideoQuit(); + SDL_VideoQuit(); } -#define systemRedShift (screenSurface->format->Rshift) -#define systemGreenShift (screenSurface->format->Gshift) -#define systemBlueShift (screenSurface->format->Bshift) -#define systemRedMask (screenSurface->format->Rmask) -#define systemGreenMask (screenSurface->format->Gmask) -#define systemBlueMask (screenSurface->format->Bmask) +#define systemRedShift (prSDLScreen->format->Rshift) +#define systemGreenShift (prSDLScreen->format->Gshift) +#define systemBlueShift (prSDLScreen->format->Bshift) +#define systemRedMask (prSDLScreen->format->Rmask) +#define systemGreenMask (prSDLScreen->format->Gmask) +#define systemBlueMask (prSDLScreen->format->Bmask) static int save_png(SDL_Surface* surface, char *path) { @@ -653,10 +628,10 @@ static void CreateScreenshot(void) current_screenshot = NULL; } - w=screenSurface->w; - h=screenSurface->h; - current_screenshot = SDL_CreateRGBSurfaceFrom(screenSurface->pixels, w, h, screenSurface->format->BitsPerPixel, screenSurface->pitch, - screenSurface->format->Rmask, screenSurface->format->Gmask, screenSurface->format->Bmask, screenSurface->format->Amask); + w=prSDLScreen->w; + h=prSDLScreen->h; + current_screenshot = SDL_CreateRGBSurfaceFrom(prSDLScreen->pixels, w, h, prSDLScreen->format->BitsPerPixel, prSDLScreen->pitch, + prSDLScreen->format->Rmask, prSDLScreen->format->Gmask, prSDLScreen->format->Bmask, prSDLScreen->format->Amask); } static int save_thumb(char *path) @@ -896,7 +871,7 @@ void gfx_set_picasso_state (int on) screen_is_picasso = on; open_screen(&currprefs); - picasso_vidinfo.rowbytes = screenSurface->pitch; + picasso_vidinfo.rowbytes = prSDLScreen->pitch; } void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt) @@ -918,7 +893,7 @@ void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgb if (screen_is_picasso) { open_screen(&currprefs); - picasso_vidinfo.rowbytes = screenSurface->pitch; + picasso_vidinfo.rowbytes = prSDLScreen->pitch; picasso_vidinfo.rgbformat = RGBFB_R5G6B5; } } @@ -926,8 +901,8 @@ void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgb uae_u8 *gfx_lock_picasso (void) { // We lock the surface directly after create and flip - picasso_vidinfo.rowbytes = screenSurface->pitch; - return (uae_u8 *)screenSurface->pixels; + picasso_vidinfo.rowbytes = prSDLScreen->pitch; + return (uae_u8 *)prSDLScreen->pixels; } void gfx_unlock_picasso (void) diff --git a/src/statusline.cpp b/src/statusline.cpp index 1f0a018d..8bdf130e 100644 --- a/src/statusline.cpp +++ b/src/statusline.cpp @@ -18,7 +18,7 @@ #include "savestate.h" #include "statusline.h" -extern SDL_Surface *amigaSurface; +extern SDL_Surface *prSDLScreen; extern int idletime_percent; /* @@ -71,7 +71,7 @@ void draw_status_line_single (uae_u8 *buf, int y, int totalwidth) x += TD_WIDTH; if(picasso_on) - memset (buf + (x - 4) * 2, 0, (amigaSurface->w - x + 4) * 2); + memset (buf + (x - 4) * 2, 0, (prSDLScreen->w - x + 4) * 2); else memset (buf + (x - 4) * gfxvidinfo.pixbytes, 0, (gfxvidinfo.outwidth - x + 4) * gfxvidinfo.pixbytes); diff --git a/src/td-sdl/thread.h b/src/td-sdl/thread.h index 75d1dae4..e4a7742c 100644 --- a/src/td-sdl/thread.h +++ b/src/td-sdl/thread.h @@ -40,7 +40,7 @@ STATIC_INLINE void uae_set_thread_priority (uae_thread_id *id, int pri) STATIC_INLINE int uae_start_thread (const TCHAR *name, void *(*f) (void *), void *arg, uae_thread_id *foo) { - uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, "StartThread", arg); + uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, arg); if(foo != NULL) *foo = id; // dbg_add_thread(id, name); @@ -49,7 +49,7 @@ STATIC_INLINE int uae_start_thread (const TCHAR *name, void *(*f) (void *), void STATIC_INLINE int uae_start_thread_fast (void *(*f) (void *), void *arg, uae_thread_id *foo) { - uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, "StartThreadFast", arg); + uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, arg); if(foo != NULL) *foo = id; // dbg_add_thread(id, "");