22 #ifndef PARALLACTION_GRAPHICS_H 23 #define PARALLACTION_GRAPHICS_H 25 #include "common/list.h" 26 #include "common/rect.h" 27 #include "common/hashmap.h" 28 #include "common/hash-str.h" 29 #include "common/str.h" 30 #include "common/stream.h" 31 #include "common/array.h" 33 #include "graphics/surface.h" 39 #include "common/pack-start.h" 51 #include "common/pack-end.h" 63 virtual void setColor(byte color) {
66 virtual uint32 getStringWidth(
const char *s) = 0;
67 virtual uint16 height() = 0;
75 virtual uint16 getNum() = 0;
76 virtual byte* getData(uint16 index) = 0;
78 virtual uint getRawSize(uint16 index) = 0;
79 virtual uint getSize(uint16 index) = 0;
99 uint16 getNum()
override {
102 byte* getData(uint16 index)
override {
113 uint getRawSize(uint16 index)
override {
115 return getSize(index);
117 uint getSize(uint16 index)
override {
119 return _surf->
w * _surf->
h;
135 _width = _height = _count = 0;
142 Cnv(uint16 numFrames, uint16 width, uint16 height, byte *data,
bool freeData =
false)
143 : _count(numFrames), _width(width), _height(height), _data(data), _freeData(freeData), field_8(0), _surf(NULL) {
147 : _count(numFrames), _width(width), _height(height), _data(NULL), _freeData(
true), field_8(0), _surf(surf) {
162 byte* getFramePtr(uint16 index) {
165 return &_data[index * _width * _height];
168 uint16 getNum()
override {
172 byte *getData(uint16 index)
override {
173 return getFramePtr(index);
182 uint getRawSize(uint16 index)
override {
183 assert(index < _count);
184 return getSize(index);
186 uint getSize(uint16 index)
override {
187 assert(index < _count);
188 return _width * _height;
198 uint16 internalWidth;
204 byte* getPtr(uint16 x, uint16 y)
const;
205 void bltOr(uint16 dx, uint16 dy,
const MaskBuffer &src, uint16 sx, uint16 sy, uint width, uint height);
206 void bltCopy(uint16 dx, uint16 dy,
const MaskBuffer &src, uint16 sx, uint16 sy, uint width, uint height);
213 void create(uint16 width, uint16 height);
216 byte getValue(uint16 x, uint16 y)
const;
224 uint16 internalWidth;
230 byte* getPtr(uint16 x, uint16 y)
const;
231 void bltCopy(uint16 dx, uint16 dy,
const PathBuffer &src, uint16 sx, uint16 sy, uint width, uint height);
238 void create(uint16 width, uint16 height);
240 byte getValue(uint16 x, uint16 y)
const;
255 void clone(
const Palette &pal);
258 void setEntries(byte* data, uint first, uint num);
259 void getEntry(uint index,
int &red,
int &green,
int &blue);
260 void setEntry(uint index,
int red,
int green,
int blue);
261 void makeGrayscale();
262 void fadeTo(
const Palette& target, uint step);
263 uint fillRGB(byte *rgb);
265 void rotate(uint first, uint last,
bool forward);
269 #define CENTER_LABEL_HORIZONTAL -1 270 #define CENTER_LABEL_VERTICAL -1 274 #define MAX_BALLOON_WIDTH 130 289 kGfxObjTypeLabel = 3,
290 kGfxObjTypeBalloon = 4,
291 kGfxObjTypeCharacter = 8,
326 GfxObj(uint type,
Frames *frames,
const char *name = NULL);
329 const char *getName()
const;
333 byte *getData(uint frame);
334 uint getRawSize(uint frame);
335 uint getSize(uint frame);
338 void setFlags(uint32 flags);
339 void clearFlags(uint32 flags);
341 return (_flags & kGfxObjVisible) == kGfxObjVisible;
347 #define LAYER_FOREGROUND 3 357 MaskPatches _maskPatches;
359 void clearMaskData();
362 PathPatches _pathPatches;
364 void clearPathData();
389 void toggleMaskPatch(uint
id,
int x,
int y,
bool apply);
390 uint16 getMaskLayer(uint16 z)
const;
397 void togglePathPatch(uint
id,
int x,
int y,
bool apply);
406 kBackgroundLocation = 1,
415 kUnselectedColor = 1,
421 virtual void reset() = 0;
422 virtual int setLocationBalloon(
const Common::String &text,
bool endGame) = 0;
423 virtual int setDialogueBalloon(
const Common::String &text, uint16 winding, TextColor textColor) = 0;
424 virtual int setSingleBalloon(
const Common::String &text, uint16 x, uint16 y, uint16 winding, TextColor textColor) = 0;
425 virtual void setBalloonText(uint
id,
const Common::String &text, TextColor textColor) = 0;
426 virtual int hitTestDialogueBalloon(
int x,
int y) = 0;
431 #define SCENE_DRAWLIST_SIZE 100 437 void resetSceneDrawList();
443 void addObjectToScene(
GfxObj *obj);
444 GfxObjArray _sceneObjects;
445 GfxObj* loadAnim(
const char *name);
446 GfxObj* loadGet(
const char *name);
447 GfxObj* loadDoor(
const char *name);
448 GfxObj* loadCharacterAnim(
const char *name);
450 void freeCharacterObjects();
451 void freeLocationObjects();
452 void showGfxObj(
GfxObj* obj,
bool visible);
457 void showFloatingLabel(
GfxObj *label);
458 void hideFloatingLabel();
460 GfxObj *renderFloatingLabel(
Font *font,
char *text);
461 GfxObj *createLabel(
Font *font,
const char *text, byte color);
462 void showLabel(
GfxObj *label, int16 x, int16 y,
bool queueTTS =
true,
bool voiceText =
true);
463 void hideLabel(
GfxObj *label);
465 void unregisterLabel(
GfxObj *label);
468 GfxObj* registerBalloon(
Frames *frames,
const char *text);
469 int setItem(
GfxObj* obj, uint16 x, uint16 y, byte transparentColor = 0);
470 void setItemFrame(uint item, uint16 f);
471 void freeDialogueObjects();
476 void patchBackground(
Graphics::Surface &surf, int16 x, int16 y,
bool mask =
false);
482 void setPalette(
Palette &palette);
483 void setBlackPalette();
484 void animatePalette();
488 void setHalfbriteMode(
bool enable);
489 void setProjectorPos(
int x,
int y);
490 void setProjectorProgram(int16 *data);
491 int16 *_nextProjectorPos;
494 void initiateScroll(
int deltaX,
int deltaY);
496 void setScrollPosX(
int scrollX);
497 void setScrollPosY(
int scrollY);
511 byte *_unpackedBitmap;
525 void updateScreenIntern();
527 bool _doubleBuffering;
530 void copyRectToScreen(
const byte *buf,
int pitch,
int x,
int y,
int w,
int h);
532 int _scrollPosX, _scrollPosY;
533 int _minScrollX, _maxScrollX, _minScrollY, _maxScrollY;
535 uint32 _requestedHScrollSteps;
536 uint32 _requestedVScrollSteps;
537 int32 _requestedHScrollDir;
538 int32 _requestedVScrollDir;
540 #define NO_FLOATING_LABEL 1000 550 GfxObjArray _balloons;
558 void drawInventory();
561 void updateFloatingLabel();
563 void drawText(
Font *font,
Graphics::Surface* surf, uint16 x, uint16 y,
const char *text, byte color);
Definition: graphics.h:244
T left
Definition: rect.h:170
int16 h
Definition: surface.h:76
Definition: graphics.h:433
void setHeight(T aHeight)
Definition: rect.h:224
void setWidth(T aWidth)
Definition: rect.h:220
Definition: graphics.h:194
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
const void * getBasePtr(int x, int y) const
Definition: surface.h:138
Definition: graphics.h:41
Definition: graphics.h:86
Definition: graphics.h:354
Definition: graphics.h:220
Definition: graphics.h:124
int16 w
Definition: surface.h:71
Definition: graphics.h:53
Definition: graphics.h:542
Definition: graphics.h:411
Definition: graphics.h:300
Definition: graphics.h:73