22 #ifndef TSAGE_GRAPHICS_H 23 #define TSAGE_GRAPHICS_H 25 #include "tsage/events.h" 26 #include "tsage/saveload.h" 27 #include "common/list.h" 28 #include "common/rect.h" 29 #include "common/system.h" 30 #include "graphics/screen.h" 43 Rect(int16 x1, int16 y1, int16 x2, int16 y2) :
Common::Rect(x1, y1, x2, y2) {}
45 void set(int16 x1, int16 y1, int16 x2, int16 y2);
46 void collapse(
int dx,
int dy);
47 void center(
int dx,
int dy);
48 void center(
const Rect &r);
50 void contain(
const Rect &r);
51 void resize(
const GfxSurface &surface,
int xp,
int yp,
int percent);
62 GfxColors() : foreground(0), background(0) {}
70 LineSlice(
int xStart,
int xEnd) { xs = xStart; xe = xEnd; }
73 enum FrameFlag { FRAME_FLIP_CENTROID_X = 4, FRAME_FLIP_CENTROID_Y = 8 };
103 void unlockSurface();
106 void setBounds(
const Rect &bounds);
107 const Rect &getBounds()
const {
return _bounds; }
110 Region *priorityRegion = NULL,
const byte *shadowMap = NULL);
112 copyFrom(src, src.getBounds(), destBounds, priorityRegion);
114 void copyFrom(
GfxSurface &src,
int destX = 0,
int destY = 0,
Region *priorityRegion = NULL) {
115 Rect tempRect = src.getBounds();
116 tempRect.
moveTo(destX, destY);
117 copyFrom(src, tempRect, priorityRegion);
126 enum TextAlign {ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2, ALIGN_JUSTIFIED = 3};
133 const byte *_fontData;
150 void setFontNumber(uint32 fontNumber);
151 int32 getHeight()
const {
return _fontSize.
y; }
152 int getCharWidth(
char ch);
153 int getStringWidth(
const char *s,
int numChars);
154 int getStringWidth(
const char *s);
155 int getStringFit(
const char *&s,
int maxWidth);
156 void getStringBounds(
const char *s,
Rect &bounds,
int maxWidth);
158 void setOwner(
GfxManager *owner) { _gfxManager = owner; }
159 void setPosition(
int xp,
int yp) { _position.
x = xp; _position.
y = yp; }
160 int writeChar(
const char ch);
161 void writeString(
const char *s);
162 void writeString(
const char *s,
int numChars);
163 void writeLines(
const char *s,
const Rect &bounds, TextAlign align);
177 enum GFX_FLAGS {GFXFLAG_THICK_FRAME = 8};
189 byte _color1, _color2, _color3;
198 virtual void setDefaults();
199 virtual void remove() { _owner = NULL; }
200 virtual void highlight();
201 virtual void draw() {}
202 virtual bool process(
Event &event) {
return false; }
203 virtual bool focusedEvent(
Event &event);
215 void setDetails(
int resNum,
int rlbNum,
int cursorNum);
217 void setDefaults()
override;
218 void draw()
override;
219 bool process(
Event &event)
override {
return false; }
225 TextAlign _textAlign;
233 void setDefaults()
override;
234 void draw()
override;
252 void setDefaults()
override;
253 void draw()
override;
254 bool process(
Event &event)
override;
276 int getStringWidth(
const char *s,
int numChars);
277 int getStringWidth(
const char *s);
278 void getStringBounds(
const char *s,
Rect &bounds,
int maxWidth);
280 void setDialogPalette();
282 _surface.setBounds(_bounds);
283 return _surface.lockSurface();
285 void unlockSurface() { _surface.unlockSurface(); }
286 void fillArea(
int xp,
int yp,
int color);
287 void fillRect(
const Rect &bounds,
int color);
288 void fillRect2(
int xs,
int ys,
int width,
int height,
int color);
289 void setFillFlag(
bool v) { _font._fillFlag = v; }
294 virtual void xorArea(
const Common::Rect &r,
int color,
int fillMode) {
300 virtual void copy(
const byte *src, byte *dest,
int size) {
303 virtual void set(byte *dest,
int size, byte val) {
307 void copyFrom(
GfxSurface &src,
int destX,
int destY);
311 _surface.setBounds(_bounds);
321 GfxElementList _elements;
330 void setTopLeft(
int xp,
int yp);
331 void setCenter(
int xp,
int yp);
334 _bounds.collapse(6, 6);
338 void setDefaults()
override;
339 void remove()
override;
340 void draw()
override;
342 static void setPalette();
344 virtual bool handleKeypress(
Event &evt,
GfxButton *&btn) {
return false; }
349 GfxSurface surfaceFromRes(
const byte *imgData);
350 GfxSurface surfaceFromRes(
int resNum,
int rlbNum,
int subNum);
Definition: managed_surface.h:51
Definition: graphics.h:57
void addDirtyRect(const Common::Rect &r) override
Definition: graphics.h:91
Definition: saveload.h:84
Definition: graphics.h:257
Definition: graphics.h:318
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
int16 width() const
Definition: rect.h:191
Definition: graphics.h:79
Definition: graphics.h:166
Definition: blueforce_dialogs.h:30
Definition: graphics.h:128
Definition: graphics.h:206
Definition: saveload.h:63
int16 x
Definition: rect.h:46
void moveTo(int16 x, int16 y)
Definition: rect.h:344
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:168
int16 y
Definition: rect.h:47
Definition: graphics.h:222
Definition: graphics.h:65
Definition: graphics.h:40
Definition: graphics.h:181
int16 height() const
Definition: rect.h:192