22 #ifndef NEVERHOOD_GRAPHICS_H 23 #define NEVERHOOD_GRAPHICS_H 25 #include "common/array.h" 26 #include "common/file.h" 27 #include "graphics/surface.h" 28 #include "neverhood/neverhood.h" 45 static NRect make(int16 x01, int16 y01, int16 x02, int16 y02) {
47 r.set(x01, y01, x02, y02);
51 void set(int16 x01, int16 y01, int16 x02, int16 y02) {
58 bool contains(int16 x, int16 y)
const {
59 return x >= x1 && x <= x2 && y >= y1 && y <= y2;
68 int16 x, y, width, height;
69 NDrawRect() : x(0), y(0), width(0), height(0) {}
70 NDrawRect(int16 x0, int16 y0, int16 width0, int16 height0) : x(x0), y(y0), width(width0), height(height0) {}
71 int16 x2() {
return x + width; }
72 int16 y2() {
return y + height; }
73 void set(int16 x0, int16 y0, int16 width0, int16 height0) {
92 void drawSpriteResourceEx(
SpriteResource &spriteResource,
bool flipX,
bool flipY, int16 width, int16 height);
93 void drawAnimResource(
AnimResource &animResource, uint frameIndex,
bool flipX,
bool flipY, int16 width, int16 height);
96 int getPriority()
const {
return _priority; }
97 void setPriority(
int priority) { _priority = priority; }
98 NDrawRect& getDrawRect() {
return _drawRect; }
99 NDrawRect& getSysRect() {
return _sysRect; }
100 NRect& getClipRect() {
return _clipRect; }
101 void setClipRect(
NRect clipRect) { _clipRect = clipRect; }
102 void setClipRects(
NRect *clipRects, uint clipRectsCount) { _clipRects = clipRects; _clipRectsCount = clipRectsCount; }
103 void clearClipRects() { _clipRects = NULL; _clipRectsCount = 0; }
104 bool getVisible()
const {
return _visible; }
105 void setVisible(
bool value) { _visible = value; }
106 void setTransparent(
bool value) { _transparent = value; }
119 uint _clipRectsCount;
128 void draw()
override;
135 FontSurface(
NeverhoodEngine *vm, NPointArray *tracking, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight);
136 FontSurface(
NeverhoodEngine *vm, uint32 fileHash, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight);
138 void drawChar(
BaseSurface *destSurface, int16 x, int16 y, byte chr);
140 int16 getStringWidth(
const byte *
string,
int stringLen);
141 uint16 getCharWidth()
const {
return _charWidth; }
142 uint16 getCharHeight()
const {
return _charHeight; }
150 NPointArray *_tracking;
155 void parseBitmapResource(
const byte *sprite,
bool *rle,
NDimensions *dimensions,
NPoint *position,
const byte **palette,
const byte **pixels);
156 void unpackSpriteRle(
const byte *source,
int width,
int height, byte *dest,
int destPitch,
bool flipX,
bool flipY, byte oldColor = 0, byte newColor = 0);
157 void unpackSpriteNormal(
const byte *source,
int width,
int height, byte *dest,
int destPitch,
bool flipX,
bool flipY);
158 int calcDistance(int16 x1, int16 y1, int16 x2, int16 y2);
Definition: background.h:30
Definition: neverhood.h:60
Definition: resource.h:51
Definition: resource.h:94
Definition: graphics.h:42
Definition: graphics.h:67
Definition: graphics.h:38
Definition: resource.h:122
Definition: graphics.h:133
Definition: graphics.h:125
Definition: graphics.h:85
Definition: graphics.h:32