mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
STARK: Move the Cursor class to the ui subfolder
This commit is contained in:
parent
b0989c7a83
commit
0f185fff27
@ -2,7 +2,6 @@ MODULE := engines/stark
|
||||
|
||||
MODULE_OBJS := \
|
||||
console.o \
|
||||
cursor.o \
|
||||
detection.o \
|
||||
gfx/driver.o \
|
||||
gfx/opengls.o \
|
||||
@ -77,6 +76,7 @@ MODULE_OBJS := \
|
||||
ui/actionmenu.o \
|
||||
ui/button.o \
|
||||
ui/clicktext.o \
|
||||
ui/cursor.o \
|
||||
ui/dialogpanel.o \
|
||||
ui/fmvplayer.o \
|
||||
ui/gamewindow.o \
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
#include "engines/stark/visual/image.h"
|
||||
|
||||
#include "engines/stark/cursor.h"
|
||||
#include "engines/stark/scene.h"
|
||||
#include "engines/stark/services/userinterface.h"
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "engines/stark/services/gameinterface.h"
|
||||
|
||||
#include "engines/stark/ui/actionmenu.h"
|
||||
#include "engines/stark/ui/cursor.h"
|
||||
#include "engines/stark/ui/dialogpanel.h"
|
||||
#include "engines/stark/ui/fmvplayer.h"
|
||||
#include "engines/stark/ui/gamewindow.h"
|
||||
@ -40,9 +41,9 @@
|
||||
|
||||
namespace Stark {
|
||||
|
||||
UserInterface::UserInterface(Gfx::Driver *gfx, Cursor *cursor) :
|
||||
UserInterface::UserInterface(Gfx::Driver *gfx) :
|
||||
_gfx(gfx),
|
||||
_cursor(cursor),
|
||||
_cursor(nullptr),
|
||||
_topMenu(nullptr),
|
||||
_dialogPanel(nullptr),
|
||||
_inventoryWindow(nullptr),
|
||||
@ -61,10 +62,12 @@ UserInterface::~UserInterface() {
|
||||
delete _dialogPanel;
|
||||
delete _inventoryWindow;
|
||||
delete _fmvPlayer;
|
||||
delete _cursor;
|
||||
}
|
||||
|
||||
void UserInterface::init() {
|
||||
// Game screen windows
|
||||
_cursor = new Cursor(_gfx);
|
||||
_topMenu = new TopMenu(_gfx, _cursor);
|
||||
_dialogPanel = new DialogPanel(_gfx, _cursor);
|
||||
_actionMenu = new ActionMenu(_gfx, _cursor);
|
||||
@ -89,6 +92,10 @@ void UserInterface::update() {
|
||||
dispatchEvent(&Window::handleMouseMove);
|
||||
}
|
||||
|
||||
void UserInterface::handleMouseMove(const Common::Point &pos) {
|
||||
_cursor->setMousePosition(pos);
|
||||
}
|
||||
|
||||
void UserInterface::handleClick() {
|
||||
dispatchEvent(&Window::handleClick);
|
||||
}
|
||||
@ -186,6 +193,9 @@ void UserInterface::render() {
|
||||
default: // Nothing goes here
|
||||
break;
|
||||
}
|
||||
|
||||
// The cursor depends on the UI being done.
|
||||
_cursor->render();
|
||||
}
|
||||
|
||||
bool UserInterface::isInteractive() const {
|
||||
|
@ -23,7 +23,7 @@
|
||||
#ifndef STARK_SERVICES_USER_INTERFACE_H
|
||||
#define STARK_SERVICES_USER_INTERFACE_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/str-array.h"
|
||||
|
||||
namespace Stark {
|
||||
@ -49,7 +49,7 @@ class Window;
|
||||
*/
|
||||
class UserInterface {
|
||||
public:
|
||||
UserInterface(Gfx::Driver *gfx, Cursor *cursor);
|
||||
UserInterface(Gfx::Driver *gfx);
|
||||
virtual ~UserInterface();
|
||||
|
||||
enum Screen {
|
||||
@ -60,6 +60,7 @@ public:
|
||||
void init();
|
||||
void update();
|
||||
void render();
|
||||
void handleMouseMove(const Common::Point &pos);
|
||||
void handleClick();
|
||||
void handleRightClick();
|
||||
void handleDoubleClick();
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "engines/stark/stark.h"
|
||||
|
||||
#include "engines/stark/console.h"
|
||||
#include "engines/stark/cursor.h"
|
||||
#include "engines/stark/debug.h"
|
||||
#include "engines/stark/resources/level.h"
|
||||
#include "engines/stark/resources/location.h"
|
||||
@ -56,7 +55,6 @@ StarkEngine::StarkEngine(OSystem *syst, const ADGameDescription *gameDesc) :
|
||||
_gfx(nullptr),
|
||||
_scene(nullptr),
|
||||
_console(nullptr),
|
||||
_cursor(nullptr),
|
||||
_global(nullptr),
|
||||
_gameInterface(nullptr),
|
||||
_archiveLoader(nullptr),
|
||||
@ -82,7 +80,6 @@ StarkEngine::StarkEngine(OSystem *syst, const ADGameDescription *gameDesc) :
|
||||
|
||||
StarkEngine::~StarkEngine() {
|
||||
delete _gameInterface;
|
||||
delete _cursor;
|
||||
delete _dialogPlayer;
|
||||
delete _randomSource;
|
||||
delete _scene;
|
||||
@ -115,9 +112,8 @@ Common::Error StarkEngine::run() {
|
||||
_fontProvider = new FontProvider();
|
||||
_scene = new Scene(_gfx);
|
||||
_dialogPlayer = new DialogPlayer();
|
||||
_cursor = new Cursor(_gfx);
|
||||
_gameInterface = new GameInterface();
|
||||
_userInterface = new UserInterface(_gfx, _cursor);
|
||||
_userInterface = new UserInterface(_gfx);
|
||||
|
||||
// Setup the public services
|
||||
StarkServices &services = StarkServices::instance();
|
||||
@ -137,7 +133,6 @@ Common::Error StarkEngine::run() {
|
||||
_resourceProvider->initGlobal();
|
||||
_staticProvider->init();
|
||||
_fontProvider->initFonts();
|
||||
_cursor->init();
|
||||
// Initialize the UI
|
||||
_userInterface->init();
|
||||
|
||||
@ -205,7 +200,7 @@ void StarkEngine::mainLoop() {
|
||||
} else if (e.type == Common::EVENT_LBUTTONUP) {
|
||||
// Do nothing for now
|
||||
} else if (e.type == Common::EVENT_MOUSEMOVE) {
|
||||
_cursor->setMousePosition(e.mouse);
|
||||
_userInterface->handleMouseMove(e.mouse);
|
||||
} else if (e.type == Common::EVENT_LBUTTONDOWN) {
|
||||
_userInterface->handleClick();
|
||||
if (_system->getMillis() - _lastClickTime < _doubleClickDelay) {
|
||||
@ -255,9 +250,6 @@ void StarkEngine::updateDisplayScene() {
|
||||
// Tell the UI to render, and update implicitly, if this leads to new mouse-over events.
|
||||
_userInterface->render();
|
||||
|
||||
// The cursor depends on the UI being done.
|
||||
_cursor->render();
|
||||
|
||||
// Swap buffers
|
||||
_gfx->flipBuffer();
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ enum StarkGameFeatures {
|
||||
|
||||
class ArchiveLoader;
|
||||
class Console;
|
||||
class Cursor;
|
||||
class DialogPlayer;
|
||||
class FontProvider;
|
||||
class Global;
|
||||
@ -91,7 +90,6 @@ private:
|
||||
const ADGameDescription *_gameDescription;
|
||||
|
||||
UserInterface *_userInterface;
|
||||
Cursor *_cursor;
|
||||
Scene *_scene;
|
||||
|
||||
// Double click handling
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "engines/stark/ui/actionmenu.h"
|
||||
|
||||
#include "engines/stark/ui/cursor.h"
|
||||
#include "engines/stark/ui/inventorywindow.h"
|
||||
|
||||
#include "engines/stark/resources/anim.h"
|
||||
@ -35,7 +36,6 @@
|
||||
#include "engines/stark/services/staticprovider.h"
|
||||
#include "engines/stark/services/global.h"
|
||||
|
||||
#include "engines/stark/cursor.h"
|
||||
#include "engines/stark/scene.h"
|
||||
|
||||
#include "engines/stark/visual/image.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/stark/cursor.h"
|
||||
#include "engines/stark/ui/cursor.h"
|
||||
|
||||
#include "engines/stark/gfx/driver.h"
|
||||
|
||||
@ -46,16 +46,13 @@ Cursor::Cursor(Gfx::Driver *gfx) :
|
||||
_fading(false),
|
||||
_fadeLevelIncreasing(true),
|
||||
_fadeLevel(0) {
|
||||
setCursorType(kDefault);
|
||||
}
|
||||
|
||||
Cursor::~Cursor() {
|
||||
delete _mouseText;
|
||||
}
|
||||
|
||||
void Cursor::init() {
|
||||
setCursorType(kDefault);
|
||||
}
|
||||
|
||||
void Cursor::setCursorType(CursorType type) {
|
||||
if (type == _currentCursorType) {
|
||||
return;
|
@ -20,8 +20,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STARK_CURSOR_H
|
||||
#define STARK_CURSOR_H
|
||||
#ifndef STARK_UI_CURSOR_H
|
||||
#define STARK_UI_CURSOR_H
|
||||
|
||||
#include "common/rect.h"
|
||||
#include "common/scummsys.h"
|
||||
@ -43,8 +43,6 @@ public:
|
||||
Cursor(Gfx::Driver *gfx);
|
||||
~Cursor();
|
||||
|
||||
void init();
|
||||
|
||||
/** Render the Cursor */
|
||||
void render();
|
||||
|
||||
@ -88,4 +86,4 @@ private:
|
||||
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_CURSOR_H
|
||||
#endif // STARK_UI_CURSOR_H
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "engines/stark/ui/gamewindow.h"
|
||||
|
||||
#include "engines/stark/cursor.h"
|
||||
#include "engines/stark/scene.h"
|
||||
|
||||
#include "engines/stark/gfx/driver.h"
|
||||
@ -39,6 +38,7 @@
|
||||
#include "engines/stark/services/userinterface.h"
|
||||
|
||||
#include "engines/stark/ui/actionmenu.h"
|
||||
#include "engines/stark/ui/cursor.h"
|
||||
#include "engines/stark/ui/inventorywindow.h"
|
||||
|
||||
namespace Stark {
|
||||
|
@ -22,9 +22,8 @@
|
||||
|
||||
#include "engines/stark/ui/inventorywindow.h"
|
||||
|
||||
#include "engines/stark/cursor.h"
|
||||
|
||||
#include "engines/stark/ui/actionmenu.h"
|
||||
#include "engines/stark/ui/cursor.h"
|
||||
|
||||
#include "engines/stark/gfx/driver.h"
|
||||
|
||||
|
@ -22,9 +22,8 @@
|
||||
|
||||
#include "engines/stark/ui/topmenu.h"
|
||||
|
||||
#include "engines/stark/cursor.h"
|
||||
|
||||
#include "engines/stark/ui/button.h"
|
||||
#include "engines/stark/ui/cursor.h"
|
||||
|
||||
#include "engines/stark/gfx/driver.h"
|
||||
|
||||
|
@ -22,14 +22,12 @@
|
||||
|
||||
#include "engines/stark/ui/window.h"
|
||||
|
||||
#include "engines/stark/cursor.h"
|
||||
|
||||
#include "engines/stark/gfx/driver.h"
|
||||
|
||||
#include "engines/stark/services/services.h"
|
||||
#include "engines/stark/ui/cursor.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
|
||||
Window::Window(Gfx::Driver *gfx, Cursor *cursor) :
|
||||
_gfx(gfx),
|
||||
_cursor(cursor),
|
||||
|
Loading…
Reference in New Issue
Block a user