Merged the cursor manipulation code - cursor views are still not done
svn-id: r45028
This commit is contained in:
parent
7cefc4cc98
commit
5aa1415397
6 changed files with 11 additions and 33 deletions
|
@ -42,6 +42,7 @@
|
||||||
#include "sci/sfx/sci_midi.h"
|
#include "sci/sfx/sci_midi.h"
|
||||||
#include "sci/vocabulary.h"
|
#include "sci/vocabulary.h"
|
||||||
#include "sci/gui/gui.h"
|
#include "sci/gui/gui.h"
|
||||||
|
#include "sci/gui/gui_cursor.h"
|
||||||
|
|
||||||
#include "common/savefile.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) {
|
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");
|
DebugPrintf("Flushing dynamically allocated ports (for memory profiling)...\n");
|
||||||
delete _vm->_gamestate->visual;
|
delete _vm->_gamestate->visual;
|
||||||
_vm->_gamestate->gfx_state->gfxResMan->freeAllResources();
|
_vm->_gamestate->gfx_state->gfxResMan->freeAllResources();
|
||||||
|
|
|
@ -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) {
|
void gfxop_set_pointer_view(GfxState *state, int nr, int loop, int cel, Common::Point *hotspot) {
|
||||||
// FIXME: For now, don't palettize pointers
|
// FIXME: For now, don't palettize pointers
|
||||||
gfx_pixmap_t *new_pointer = state->gfxResMan->getView(nr, &loop, &cel, 0)->loops[loop].cels[cel];
|
gfx_pixmap_t *new_pointer = state->gfxResMan->getView(nr, &loop, &cel, 0)->loops[loop].cels[cel];
|
||||||
|
|
|
@ -363,14 +363,6 @@ void gfxop_free_color(GfxState *state, gfx_color_t *color);
|
||||||
*/
|
*/
|
||||||
void gfxop_sleep(GfxState *state, uint32 msecs);
|
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.
|
* Sets the mouse pointer to a view resource.
|
||||||
*
|
*
|
||||||
|
|
|
@ -114,13 +114,15 @@ public:
|
||||||
// FIXME: Don't store EngineState
|
// FIXME: Don't store EngineState
|
||||||
virtual void resetEngineState(EngineState *s);
|
virtual void resetEngineState(EngineState *s);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SciGuiCursor *_cursor;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void initPriorityBands();
|
virtual void initPriorityBands();
|
||||||
|
|
||||||
EngineState *_s;
|
EngineState *_s;
|
||||||
SciGuiScreen *_screen;
|
SciGuiScreen *_screen;
|
||||||
SciGuiPalette *_palette;
|
SciGuiPalette *_palette;
|
||||||
SciGuiCursor *_cursor;
|
|
||||||
SciGuiGfx *_gfx;
|
SciGuiGfx *_gfx;
|
||||||
SciGuiresources *_resources;
|
SciGuiresources *_resources;
|
||||||
SciGuiWindowMgr *_windowMgr;
|
SciGuiWindowMgr *_windowMgr;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "sci/gfx/gfx_widgets.h"
|
#include "sci/gfx/gfx_widgets.h"
|
||||||
#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual
|
#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual
|
||||||
#include "sci/gui32/gui32.h"
|
#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
|
// This is the real width of a text with a specified width of 0
|
||||||
#define MAX_TEXT_WIDTH_MAGIC_VALUE 192
|
#define MAX_TEXT_WIDTH_MAGIC_VALUE 192
|
||||||
|
@ -67,6 +68,7 @@ namespace Sci {
|
||||||
|
|
||||||
SciGui32::SciGui32( EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor)
|
SciGui32::SciGui32( EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor)
|
||||||
: s(state) {
|
: s(state) {
|
||||||
|
_cursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
SciGui32::~SciGui32() {
|
SciGui32::~SciGui32() {
|
||||||
|
@ -2444,18 +2446,15 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SciGui32::hideCursor() {
|
void SciGui32::hideCursor() {
|
||||||
CursorMan.showMouse(false);
|
_cursor->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SciGui32::showCursor() {
|
void SciGui32::showCursor() {
|
||||||
CursorMan.showMouse(true);
|
_cursor->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SciGui32::setCursorShape(GuiResourceId cursorId) {
|
void SciGui32::setCursorShape(GuiResourceId cursorId) {
|
||||||
if (cursorId == -1)
|
_cursor->setShape(cursorId);
|
||||||
gfxop_set_pointer_cursor(s->gfx_state, GFXOP_NO_POINTER);
|
|
||||||
else
|
|
||||||
gfxop_set_pointer_cursor(s->gfx_state, cursorId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SciGui32::setCursorPos(Common::Point pos) {
|
void SciGui32::setCursorPos(Common::Point pos) {
|
||||||
|
|
|
@ -197,6 +197,7 @@ Common::Error SciEngine::run() {
|
||||||
script_free_engine(_gamestate); // Uninitialize game state
|
script_free_engine(_gamestate); // Uninitialize game state
|
||||||
script_free_breakpoints(_gamestate);
|
script_free_breakpoints(_gamestate);
|
||||||
|
|
||||||
|
delete cursor;
|
||||||
delete palette;
|
delete palette;
|
||||||
delete screen;
|
delete screen;
|
||||||
delete _gamestate;
|
delete _gamestate;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue