STARK: Use an actual game cursor
This commit is contained in:
parent
73ee04635a
commit
ffa10dafab
5 changed files with 35 additions and 14 deletions
|
@ -24,17 +24,25 @@
|
|||
|
||||
#include "engines/stark/gfx/driver.h"
|
||||
#include "engines/stark/gfx/texture.h"
|
||||
#include "engines/stark/services/services.h"
|
||||
#include "engines/stark/services/staticprovider.h"
|
||||
#include "engines/stark/visual/image.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
Cursor::Cursor(Gfx::Driver *gfx) :
|
||||
_gfx(gfx) {
|
||||
// TODO: This is just a quick solution to get anything drawn, we will need load-code for the actual pointers.
|
||||
_cursorTexture = _gfx->createTextureFromString("X", 0xFF00FF00);
|
||||
_gfx(gfx),
|
||||
_cursorImage(nullptr) {
|
||||
}
|
||||
|
||||
Cursor::~Cursor() {
|
||||
delete _cursorTexture;
|
||||
}
|
||||
|
||||
void Cursor::init() {
|
||||
StaticProvider *staticProvider = StarkServices::instance().staticProvider;
|
||||
|
||||
// TODO: This is just a quick solution to get anything drawn.
|
||||
_cursorImage = staticProvider->getCursorImage(0);
|
||||
}
|
||||
|
||||
void Cursor::setMousePosition(Common::Point pos) {
|
||||
|
@ -44,7 +52,7 @@ void Cursor::setMousePosition(Common::Point pos) {
|
|||
void Cursor::render() {
|
||||
_gfx->setScreenViewport(true); // The cursor is drawn unscaled
|
||||
|
||||
_gfx->drawSurface(_cursorTexture, _mousePos);
|
||||
_cursorImage->render(_mousePos);
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class VisualImageXMG;
|
||||
|
||||
namespace Gfx {
|
||||
class Driver;
|
||||
class Texture;
|
||||
|
@ -41,6 +43,8 @@ public:
|
|||
Cursor(Gfx::Driver *gfx);
|
||||
~Cursor();
|
||||
|
||||
void init();
|
||||
|
||||
/**
|
||||
* Render the Cursor
|
||||
*/
|
||||
|
@ -53,7 +57,7 @@ private:
|
|||
Gfx::Driver *_gfx;
|
||||
|
||||
Common::Point _mousePos;
|
||||
Gfx::Texture *_cursorTexture;
|
||||
VisualImageXMG *_cursorImage;
|
||||
};
|
||||
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -22,18 +22,12 @@
|
|||
|
||||
#include "engines/stark/services/staticprovider.h"
|
||||
|
||||
#include "engines/stark/resources/bookmark.h"
|
||||
#include "engines/stark/resources/camera.h"
|
||||
#include "engines/stark/resources/floor.h"
|
||||
#include "engines/stark/resources/anim.h"
|
||||
#include "engines/stark/resources/item.h"
|
||||
#include "engines/stark/resources/layer.h"
|
||||
#include "engines/stark/resources/level.h"
|
||||
#include "engines/stark/resources/location.h"
|
||||
#include "engines/stark/resources/root.h"
|
||||
#include "engines/stark/resources/script.h"
|
||||
#include "engines/stark/services/archiveloader.h"
|
||||
#include "engines/stark/services/global.h"
|
||||
#include "engines/stark/services/stateprovider.h"
|
||||
#include "engines/stark/visual/image.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
|
@ -52,6 +46,9 @@ void StaticProvider::init() {
|
|||
|
||||
// Resources lifecycle update
|
||||
_level->onAllLoaded();
|
||||
|
||||
Resources::Item *staticItem = _level->findChild<Resources::Item>();
|
||||
_stockAnims = staticItem->listChildren<Resources::Anim>();
|
||||
}
|
||||
|
||||
void StaticProvider::shutdown() {
|
||||
|
@ -61,4 +58,9 @@ void StaticProvider::shutdown() {
|
|||
_archiveLoader->unloadUnused();
|
||||
}
|
||||
|
||||
VisualImageXMG *StaticProvider::getCursorImage(uint32 stockAnim) {
|
||||
Resources::Anim *anim = _stockAnims[stockAnim];
|
||||
return anim->getVisual()->get<VisualImageXMG>();
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -23,16 +23,19 @@
|
|||
#ifndef STARK_STATIC_PROVIDER_H
|
||||
#define STARK_STATIC_PROVIDER_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
namespace Resources {
|
||||
class Anim;
|
||||
class Level;
|
||||
}
|
||||
|
||||
class ArchiveLoader;
|
||||
class Global;
|
||||
class VisualImageXMG;
|
||||
|
||||
/**
|
||||
* Static Resource provider.
|
||||
|
@ -53,11 +56,14 @@ public:
|
|||
/** Obtain the static level */
|
||||
Resources::Level *getLevel() const { return _level; }
|
||||
|
||||
VisualImageXMG *getCursorImage(uint32 stockAnim);
|
||||
|
||||
private:
|
||||
ArchiveLoader *_archiveLoader;
|
||||
Global *_global;
|
||||
|
||||
Resources::Level *_level;
|
||||
Common::Array<Resources::Anim *> _stockAnims;
|
||||
};
|
||||
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -124,6 +124,7 @@ Common::Error StarkEngine::run() {
|
|||
// Load global resources
|
||||
_resourceProvider->initGlobal();
|
||||
_staticProvider->init();
|
||||
_cursor->init();
|
||||
|
||||
// Start us up at the house of all worlds
|
||||
_global->setCurrentChapter(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue