TITANIC: Fleshing out screen manager

This commit is contained in:
Paul Gilbert 2016-07-03 12:48:05 -04:00
parent 4840e3e86b
commit d9e05e215c
2 changed files with 106 additions and 24 deletions

View File

@ -130,8 +130,15 @@ DirectDrawSurface *OSScreenManager::getDDSurface(SurfaceNum surfaceNum) {
return nullptr;
}
void OSScreenManager::proc6() {}
void OSScreenManager::proc7() {}
CVideoSurface *OSScreenManager::lockSurface(SurfaceNum surfaceNum) {
CVideoSurface *surface = getSurface(surfaceNum);
surface->lock();
return surface;
}
void OSScreenManager::unlockSurface(CVideoSurface *surface) {
surface->unlock();
}
CVideoSurface *OSScreenManager::getSurface(SurfaceNum surfaceNum) const {
if (surfaceNum == SURFACE_PRIMARY)
@ -233,7 +240,11 @@ int OSScreenManager::writeString(int surfaceNum, const Rect &destRect,
yOffset, str, textCursor);
}
void OSScreenManager::proc14() {}
int OSScreenManager::writeString(int surfaceNum, const Rect &srcRect,
const Rect &destRect, const CString &str, CTextCursor *textCursor) {
// TODO
return 0;
}
void OSScreenManager::setFontColor(byte r, byte g, byte b) {
_fonts[_fontNumber].setColor(r, g, b);
@ -251,7 +262,15 @@ int OSScreenManager::stringWidth(const CString &str) {
return _fonts[_fontNumber].stringWidth(str);
}
void OSScreenManager::proc19() {}
void OSScreenManager::frameRect(SurfaceNum surfaceNum, const Rect &rect, byte r, byte g, byte b) {
Rect top(rect.left, rect.top, rect.right, rect.top + 1);
fillRect(surfaceNum, &top, r, g, b);
Rect bottom(rect.left, rect.bottom - 1, rect.right, rect.bottom);
fillRect(surfaceNum, &bottom, r, g, b);
Rect left(rect.left, rect.top, rect.left + 1, rect.bottom);
fillRect(surfaceNum, &left, r, g, b);
Rect right(rect.right - 1, rect.top, rect.right, rect.bottom);
}
void OSScreenManager::clearSurface(SurfaceNum surfaceNum, Rect *bounds) {
if (surfaceNum == SURFACE_PRIMARY)
@ -274,16 +293,12 @@ CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) {
return new OSVideoSurface(this, key);
}
void OSScreenManager::proc23() {}
void OSScreenManager::proc24() {}
void OSScreenManager::proc25() {}
void OSScreenManager::showCursor() {
CScreenManager::_screenManagerPtr->_mouseCursor->show();
}
void OSScreenManager::hideCursor() {
CScreenManager::_screenManagerPtr->_mouseCursor->hide();
}
void OSScreenManager::destroyFrontAndBackBuffers() {

View File

@ -89,8 +89,19 @@ public:
*/
virtual void drawCursors() = 0;
virtual void proc6() = 0;
virtual void proc7() = 0;
/**
* Locks a specified surface number for access and returns a pointer to it
*/
virtual CVideoSurface *lockSurface(SurfaceNum surfaceNum) = 0;
/**
* Unlocks a previously locked surface
*/
virtual void unlockSurface(CVideoSurface *surface) = 0;
/**
* Gets a specified surface number
*/
virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const = 0;
/**
@ -126,7 +137,16 @@ public:
virtual int writeString(int surfaceNum, const Rect &destRect,
int yOffset, const CString &str, CTextCursor *textCursor) = 0;
virtual void proc14() = 0;
/**
* Write a string
* @param surfaceNum Destination surface
* @param srcRect Drawing area
* @param destRect Bounds of dest surface
* @param str Line or lines to write
* @param textCursor Optional text cursor pointer
*/
virtual int writeString(int surfaceNum, const Rect &srcRect,
const Rect &destRect, const CString &str, CTextCursor *textCursor) = 0;
/**
* Set the font color
@ -152,7 +172,10 @@ public:
*/
virtual int stringWidth(const CString &str) = 0;
virtual void proc19() = 0;
/**
* Draws a frame enclosing the specified area
*/
virtual void frameRect(SurfaceNum surfaceNum, const Rect &rect, byte r, byte g, byte b) = 0;
/**
* Clear a portion of a specified surface
@ -173,10 +196,27 @@ public:
* Creates a surface from a specified resource
*/
virtual CVideoSurface *createSurface(const CResourceKey &key) = 0;
virtual void proc24() = 0;
virtual void proc25() = 0;
/**
* Get the top-left corner of the screen in global screen co-ordinates
* For ScummVM, this is always (0, 0), even in Windowed mode
*/
virtual Point getScreenTopLeft() { return Point(0, 0); }
/**
* Waits for a vertical screen sync
* For ScummVM, this can be safely ignored
*/
virtual void waitForVSync() {}
/**
* Show the mouse cursor
*/
virtual void showCursor() = 0;
/**
* Hide the mouse cursor
*/
virtual void hideCursor() = 0;
/**
@ -228,8 +268,19 @@ public:
*/
virtual void drawCursors();
virtual void proc6();
virtual void proc7();
/**
* Locks a specified surface number for access and returns a pointer to it
*/
virtual CVideoSurface *lockSurface(SurfaceNum surfaceNum);
/**
* Unlocks a previously locked surface
*/
virtual void unlockSurface(CVideoSurface *surface);
/**
* Gets a specified surface number
*/
virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const;
/**
@ -268,7 +319,16 @@ public:
virtual int writeString(int surfaceNum, const Rect &destRect,
int yOffset, const CString &str, CTextCursor *textCursor);
virtual void proc14();
/**
* Write a string
* @param surfaceNum Destination surface
* @param srcRect Drawing area
* @param destRect Bounds of dest surface
* @param str Line or lines to write
* @param textCursor Optional text cursor pointer
*/
virtual int writeString(int surfaceNum, const Rect &srcRect,
const Rect &destRect, const CString &str, CTextCursor *textCursor);
/**
* Set the font color
@ -294,7 +354,10 @@ public:
*/
virtual int stringWidth(const CString &str);
virtual void proc19();
/**
* Draws a frame enclosing the specified area
*/
virtual void frameRect(SurfaceNum surfaceNum, const Rect &rect, byte r, byte g, byte b);
/**
* Clear a portion of the screen surface
@ -316,10 +379,14 @@ public:
*/
virtual CVideoSurface *createSurface(const CResourceKey &key);
virtual void proc23();
virtual void proc24();
virtual void proc25();
/**
* Show the mouse cursor
*/
virtual void showCursor();
/**
* Hide the mouse cursor
*/
virtual void hideCursor();
};