ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

locationscreen.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_UI_MENU_LOCATION_SCREEN_H
00024 #define STARK_UI_MENU_LOCATION_SCREEN_H
00025 
00026 #include "engines/stark/ui/screen.h"
00027 #include "engines/stark/ui/window.h"
00028 #include "engines/stark/visual/text.h"
00029 
00030 namespace Stark {
00031 
00032 namespace Gfx {
00033 class RenderEntry;
00034 }
00035 
00036 namespace Resources {
00037 class ItemVisual;
00038 class Location;
00039 class Sound;
00040 }
00041 
00042 class StaticLocationWidget;
00043 
00047 class StaticLocationScreen : public SingleWindowScreen {
00048 public:
00049     StaticLocationScreen(Gfx::Driver *gfx, Cursor *cursor, const char *locationName, Screen::Name screenName);
00050     ~StaticLocationScreen() override;
00051 
00052     // Screen API
00053     void open() override;
00054     void close() override;
00055     void onScreenChanged() override;
00056 
00064     void waitForSoundsToComplete();
00065 
00066 protected:
00067     // Window API
00068     void onMouseMove(const Common::Point &pos) override;
00069     void onClick(const Common::Point &pos) override;
00070     void onGameLoop() override;
00071     void onRender() override;
00072 
00073     Common::Array<StaticLocationWidget *> _widgets;
00074 
00075 private:
00076     const char *_locationName;
00077     Resources::Location *_location;
00078     int _hoveredWidgetIndex;
00079 
00080     void freeWidgets();
00081 };
00082 
00083 typedef Common::Functor0<void> WidgetOnClickCallback;
00084 typedef Common::Functor2<StaticLocationWidget &, const Common::Point &, void> WidgetOnMouseMoveCallback;
00085 #define CLICK_HANDLER(cls, method) new Common::Functor0Mem<void, cls>(this, &cls::method)
00086 #define MOVE_HANDLER(cls, method) new Common::Functor2Mem<StaticLocationWidget &, const Common::Point &, void, cls>(this, &cls::method)
00087 
00093 class StaticLocationWidget {
00094 public:
00095     StaticLocationWidget(const char *renderEntryName, WidgetOnClickCallback *onClickCallback,
00096                          WidgetOnMouseMoveCallback *onMouseMoveCallback);
00097     virtual ~StaticLocationWidget();
00098 
00100     virtual void render();
00101 
00103     virtual bool isMouseInside(const Common::Point &mousePos) const;
00104 
00106     virtual void onClick();
00107 
00109     virtual void onMouseMove(const Common::Point &mousePos);
00110 
00112     virtual void onMouseUp() {}
00113 
00115     virtual void onScreenChanged();
00116 
00118     void setupSounds(int16 enterSound, int16 clickSound);
00119 
00125     void setTextColor(const Color &textColor);
00126 
00128     bool isVisible() const;
00129     void setVisible(bool visible);
00130 
00132     void onGameLoop();
00133 
00135     void onMouseEnter();
00136 
00138     void onMouseLeave();
00139 
00140 protected:
00141     Common::Point getPosition() const;
00142     Gfx::RenderEntry *_renderEntry;
00143 
00144 private:
00145     Resources::ItemVisual *_item;
00146     bool _visible;
00147 
00148     Resources::Sound *_soundMouseEnter;
00149     Resources::Sound *_soundMouseClick;
00150 
00151     WidgetOnClickCallback *_onClick;
00152     WidgetOnMouseMoveCallback *_onMouseMove;
00153 };
00154 
00155 } // End of namespace Stark
00156 
00157  #endif // STARK_UI_MENU_LOCATION_SCREEN_H


Generated on Sat Mar 16 2019 05:01:43 for ResidualVM by doxygen 1.7.1
curved edge   curved edge