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);
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; }
73enum FrameFlag { FRAME_FLIP_CENTROID_X = 4, FRAME_FLIP_CENTROID_Y = 8 };
103 void unlockSurface();
105 void create(int16 width, int16 height)
override;
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);
120 GfxSurface &operator=(
const GfxSurface &s);
126enum 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);
177enum 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;
231 void set(
const Common::String &s,
int width, 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);
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; }
349GfxSurface surfaceFromRes(
const byte *imgData);
350GfxSurface surfaceFromRes(
int resNum,
int rlbNum,
int subNum);
Definition: managed_surface.h:51
Definition: graphics.h:57
Definition: graphics.h:318
Definition: graphics.h:181
Definition: graphics.h:166
Definition: graphics.h:128
Definition: graphics.h:206
Definition: graphics.h:257
Definition: graphics.h:222
Definition: graphics.h:79
void addDirtyRect(const Common::Rect &r) override
Definition: graphics.h:91
void create(int16 width, int16 height) override
Definition: graphics.h:65
Definition: graphics.h:40
Definition: saveload.h:84
Definition: saveload.h:63
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:168
TextAlign
Definition: font.h:48
void moveTo(T x, T y)
Definition: rect.h:399
Point center() const
Definition: rect.h:488