Merged the cursor manipulation code - cursor views are still not done

svn-id: r45028
This commit is contained in:
Filippos Karapetis 2009-10-13 16:22:07 +00:00
parent 7cefc4cc98
commit 5aa1415397
6 changed files with 11 additions and 33 deletions

View file

@ -42,6 +42,7 @@
#include "sci/sfx/sci_midi.h"
#include "sci/vocabulary.h"
#include "sci/gui/gui.h"
#include "sci/gui/gui_cursor.h"
#include "common/savefile.h"
@ -1196,7 +1197,7 @@ bool Console::cmdVisualState(int argc, const char **argv) {
}
bool Console::cmdFlushPorts(int argc, const char **argv) {
gfxop_set_pointer_cursor(_vm->_gamestate->gfx_state, GFXOP_NO_POINTER);
_vm->_gamestate->_cursor->setShape(GFXOP_NO_POINTER);
DebugPrintf("Flushing dynamically allocated ports (for memory profiling)...\n");
delete _vm->_gamestate->visual;
_vm->_gamestate->gfx_state->gfxResMan->freeAllResources();

View file

@ -967,23 +967,6 @@ void gfxop_sleep(GfxState *state, uint32 msecs) {
}
}
void gfxop_set_pointer_cursor(GfxState *state, int nr) {
if (nr == GFXOP_NO_POINTER) {
state->driver->setPointer(NULL, NULL);
return;
}
gfx_pixmap_t *new_pointer = state->gfxResMan->getCursor(nr);
if (!new_pointer) {
warning("[GFX] Attempt to set invalid pointer #%d\n", nr);
return;
}
Common::Point p = Common::Point(new_pointer->xoffset, new_pointer->yoffset);
state->driver->setPointer(new_pointer, &p);
}
void gfxop_set_pointer_view(GfxState *state, int nr, int loop, int cel, Common::Point *hotspot) {
// FIXME: For now, don't palettize pointers
gfx_pixmap_t *new_pointer = state->gfxResMan->getView(nr, &loop, &cel, 0)->loops[loop].cels[cel];

View file

@ -363,14 +363,6 @@ void gfxop_free_color(GfxState *state, gfx_color_t *color);
*/
void gfxop_sleep(GfxState *state, uint32 msecs);
/**
* Sets the mouse pointer to a cursor resource.
*
* @param[in] state The affected state
* @param[in] nr Number of the cursor resource to use
*/
void gfxop_set_pointer_cursor(GfxState *state, int nr);
/**
* Sets the mouse pointer to a view resource.
*

View file

@ -114,13 +114,15 @@ public:
// FIXME: Don't store EngineState
virtual void resetEngineState(EngineState *s);
protected:
SciGuiCursor *_cursor;
private:
virtual void initPriorityBands();
EngineState *_s;
SciGuiScreen *_screen;
SciGuiPalette *_palette;
SciGuiCursor *_cursor;
SciGuiGfx *_gfx;
SciGuiresources *_resources;
SciGuiWindowMgr *_windowMgr;

View file

@ -37,6 +37,7 @@
#include "sci/gfx/gfx_widgets.h"
#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual
#include "sci/gui32/gui32.h"
#include "sci/gui/gui_cursor.h"
// This is the real width of a text with a specified width of 0
#define MAX_TEXT_WIDTH_MAGIC_VALUE 192
@ -67,6 +68,7 @@ namespace Sci {
SciGui32::SciGui32( EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor)
: s(state) {
_cursor = cursor;
}
SciGui32::~SciGui32() {
@ -2444,18 +2446,15 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
}
void SciGui32::hideCursor() {
CursorMan.showMouse(false);
_cursor->hide();
}
void SciGui32::showCursor() {
CursorMan.showMouse(true);
_cursor->show();
}
void SciGui32::setCursorShape(GuiResourceId cursorId) {
if (cursorId == -1)
gfxop_set_pointer_cursor(s->gfx_state, GFXOP_NO_POINTER);
else
gfxop_set_pointer_cursor(s->gfx_state, cursorId);
_cursor->setShape(cursorId);
}
void SciGui32::setCursorPos(Common::Point pos) {

View file

@ -197,6 +197,7 @@ Common::Error SciEngine::run() {
script_free_engine(_gamestate); // Uninitialize game state
script_free_breakpoints(_gamestate);
delete cursor;
delete palette;
delete screen;
delete _gamestate;