GRAPHICS: Move MacMenu constants

This commit is contained in:
Borja Lorente 2016-07-29 12:05:46 +02:00
parent 1080f19995
commit 9ce6fbd0d7
10 changed files with 97 additions and 85 deletions

View File

@ -55,12 +55,12 @@ namespace Wage {
struct PlotData {
Graphics::ManagedSurface *surface;
Graphics::Patterns *patterns;
Graphics::MacPatterns *patterns;
uint fillType;
int thickness;
Design *design;
PlotData(Graphics::ManagedSurface *s, Patterns *p, int f, int t, Design *d) :
PlotData(Graphics::ManagedSurface *s, Graphics::MacPatterns *p, int f, int t, Design *d) :
surface(s), patterns(p), fillType(f), thickness(t), design(d) {}
};
@ -85,7 +85,7 @@ Design::~Design() {
delete _surface;
}
void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x, int y) {
void Design::paint(Graphics::ManagedSurface *surface, Graphics::MacPatterns &patterns, int x, int y) {
bool needRender = false;
if (_surface == NULL) {
@ -141,7 +141,7 @@ void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x,
}
}
void Design::render(Patterns &patterns) {
void Design::render(Graphics::MacPatterns &patterns) {
Common::MemoryReadStream in(_data, _len);
bool needRender = true;
@ -265,7 +265,7 @@ void drawPixelPlain(int x, int y, int color, void *data) {
}
void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
int16 y2 = in.readSint16BE();
@ -294,7 +294,7 @@ void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
}
void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
int16 y2 = in.readSint16BE();
@ -320,7 +320,7 @@ void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream
}
void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
byte ignored = in.readSint16BE(); // ignored
@ -397,7 +397,7 @@ void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &
}
void Design::drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
int16 y2 = in.readSint16BE();
@ -501,11 +501,11 @@ void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadS
tmp.free();
}
void Design::drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType) {
void Design::drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) {
drawRect(surface, rect.left, rect.top, rect.right, rect.bottom, thickness, color, patterns, fillType);
}
void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Patterns &patterns, byte fillType) {
void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, thickness, nullptr);
Graphics::drawLine(x1, y1, x2, y1, kColorBlack, drawPixel, &pd);
@ -515,26 +515,26 @@ void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2,
}
void Design::drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType) {
void Design::drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, 1, nullptr);
for (int y = rect.top; y <= rect.bottom; y++)
Graphics::drawHLine(rect.left, rect.right, y, color, drawPixel, &pd);
}
void Design::drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Patterns &patterns, byte fillType) {
void Design::drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, 1, nullptr);
Graphics::drawRoundRect(rect, arc, color, true, drawPixel, &pd);
}
void Design::drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Patterns &patterns, byte fillType) {
void Design::drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, thickness, nullptr);
Graphics::drawHLine(x1, x2, y, color, drawPixel, &pd);
}
void Design::drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Patterns &patterns, byte fillType) {
void Design::drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, thickness, nullptr);
Graphics::drawVLine(x, y1, y2, color, drawPixel, &pd);

View File

@ -56,7 +56,6 @@
namespace Wage {
using namespace Graphics::MacGUIConstants;
using Graphics::Patterns;
class Design {
public:
@ -71,14 +70,14 @@ public:
return _bounds;
}
void paint(Graphics::ManagedSurface *canvas, Graphics::Patterns &patterns, int x, int y);
void paint(Graphics::ManagedSurface *canvas, Graphics::MacPatterns &patterns, int x, int y);
bool isPointOpaque(int x, int y);
static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::Patterns &patterns, byte fillType);
static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::Patterns &patterns, byte fillType);
static void drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Graphics::Patterns &patterns, byte fillType);
static void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Graphics::Patterns &patterns, byte fillType);
static void drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Graphics::Patterns &patterns, byte fillType);
static void drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Graphics::Patterns &patterns, byte fillType);
static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
static void drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Graphics::MacPatterns &patterns, byte fillType);
static void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Graphics::MacPatterns &patterns, byte fillType);
static void drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
static void drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
bool isBoundsCalculation() { return _boundsCalculationMode; }
void adjustBounds(int16 x, int16 y);
@ -91,15 +90,15 @@ private:
bool _boundsCalculationMode;
private:
void render(Patterns &patterns);
void render(Graphics::MacPatterns &patterns);
void drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
void drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
void drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
void drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
void drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadStream &in);
};

View File

@ -60,10 +60,7 @@
namespace Wage {
// Import the enum definitions
using namespace Graphics::MacMenuConstants;
using namespace Graphics::MacWindowConstants;
using namespace Graphics::MacGUIConstants;
class Scene;
class WageEngine;
@ -72,6 +69,44 @@ enum {
kCursorHeight = 12
};
enum {
kFontStyleBold = 1,
kFontStyleItalic = 2,
kFontStyleUnderline = 4,
kFontStyleOutline = 8,
kFontStyleShadow = 16,
kFontStyleCondensed = 32,
kFontStyleExtended = 64
};
enum {
kMenuHighLevel = -1,
kMenuAbout = 0,
kMenuFile = 1,
kMenuEdit = 2,
kMenuCommands = 3,
kMenuWeapons = 4
};
enum {
kMenuActionAbout,
kMenuActionNew,
kMenuActionOpen,
kMenuActionClose,
kMenuActionSave,
kMenuActionSaveAs,
kMenuActionRevert,
kMenuActionQuit,
kMenuActionUndo,
kMenuActionCut,
kMenuActionCopy,
kMenuActionPaste,
kMenuActionClear,
kMenuActionCommand
};
class Gui {
public:
Gui(WageEngine *engine);

View File

@ -75,7 +75,7 @@ World::World(WageEngine *engine) {
_engine = engine;
_patterns = new Patterns;
_patterns = new Graphics::MacPatterns;
}
World::~World() {

View File

@ -54,7 +54,7 @@
namespace Wage {
// Import the enum definitions
using Graphics::Patterns;
using Graphics::MacPatterns;
class Script;
class Sound;
@ -92,7 +92,7 @@ public:
ObjArray _orderedObjs;
ChrArray _orderedChrs;
Common::Array<Sound *> _orderedSounds;
Graphics::Patterns *_patterns;
Graphics::MacPatterns *_patterns;
Scene *_storageScene;
Chr *_player;
int _signature;

View File

@ -66,6 +66,25 @@ enum {
kMenuItemHeight = 20
};
enum {
kMenuHighLevel = -1
};
enum {
kFontStyleBold = 1,
kFontStyleItalic = 2,
kFontStyleUnderline = 4,
kFontStyleOutline = 8,
kFontStyleShadow = 16,
kFontStyleCondensed = 32,
kFontStyleExtended = 64
};
enum {
kMenuActionCommand
};
struct MenuSubItem {
Common::String text;
int action;

View File

@ -53,47 +53,6 @@ namespace Graphics {
struct MenuItem;
struct MenuSubItem;
namespace MacMenuConstants {
enum MacMenuFontStyle {
kFontStyleBold = 1,
kFontStyleItalic = 2,
kFontStyleUnderline = 4,
kFontStyleOutline = 8,
kFontStyleShadow = 16,
kFontStyleCondensed = 32,
kFontStyleExtended = 64
};
enum MacMenuTab {
kMenuHighLevel = -1,
kMenuAbout = 0,
kMenuFile = 1,
kMenuEdit = 2,
kMenuCommands = 3,
kMenuWeapons = 4
};
enum MacMenuAction {
kMenuActionAbout,
kMenuActionNew,
kMenuActionOpen,
kMenuActionClose,
kMenuActionSave,
kMenuActionSaveAs,
kMenuActionRevert,
kMenuActionQuit,
kMenuActionUndo,
kMenuActionCut,
kMenuActionCopy,
kMenuActionPaste,
kMenuActionClear,
kMenuActionCommand
};
}
using namespace MacMenuConstants;
struct MenuData {
int menunum;
const char *title;

View File

@ -186,11 +186,11 @@ void MacWindowManager::setActive(int id) {
struct PlotData {
Graphics::ManagedSurface *surface;
Patterns *patterns;
MacPatterns *patterns;
uint fillType;
int thickness;
PlotData(Graphics::ManagedSurface *s, Patterns *p, int f, int t) :
PlotData(Graphics::ManagedSurface *s, MacPatterns *p, int f, int t) :
surface(s), patterns(p), fillType(f), thickness(t) {}
};

View File

@ -63,7 +63,7 @@ namespace MacGUIConstants {
kDesktopArc = 7
};
enum MacGUIColor {
enum {
kColorBlack = 0,
kColorGray = 1,
kColorWhite = 2,
@ -71,7 +71,7 @@ namespace MacGUIConstants {
kColorGreen2 = 4
};
enum MacGUIPattern {
enum {
kPatternSolid = 1,
kPatternStripes = 2,
kPatternCheckers = 3,
@ -84,7 +84,7 @@ class ManagedSurface;
class Menu;
typedef Common::Array<byte *> Patterns;
typedef Common::Array<byte *> MacPatterns;
class MacWindowManager {
public:
@ -107,7 +107,7 @@ public:
BaseMacWindow *getWindow(int id) { return _windows[id]; }
Patterns &getPatterns() { return _patterns; }
MacPatterns &getPatterns() { return _patterns; }
void drawFilledRoundRect(ManagedSurface *surface, Common::Rect &rect, int arc, int color);
void pushArrowCursor();
@ -128,7 +128,7 @@ private:
bool _fullRefresh;
Patterns _patterns;
MacPatterns _patterns;
Menu *_menu;