summaryrefslogtreecommitdiff
path: root/gfx.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-10-24 23:11:40 +0000
committerDarkvater <darkvater@openttd.org>2006-10-24 23:11:40 +0000
commit93599c1be548fb9938d5da8d45c96e9ece760ea1 (patch)
tree693dc8ed0e57eac872a5a10ac2491d57f70a9b23 /gfx.c
parentb63d9468984c2dd52461e61c90b52274373b8c43 (diff)
downloadopenttd-93599c1be548fb9938d5da8d45c96e9ece760ea1.tar.xz
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
of order_gui (only disable a single widget if not local player, all others aren't visible anyways).
Diffstat (limited to 'gfx.c')
-rw-r--r--gfx.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gfx.c b/gfx.c
index e54680453..8ffb5de59 100644
--- a/gfx.c
+++ b/gfx.c
@@ -33,22 +33,19 @@ static byte _string_colorremap[3];
#define DIRTY_BYTES_PER_LINE (MAX_SCREEN_WIDTH / 64)
static byte _dirty_blocks[DIRTY_BYTES_PER_LINE * MAX_SCREEN_HEIGHT / 8];
-
-
-void memcpy_pitch(void *d, void *s, int w, int h, int spitch, int dpitch)
+void memcpy_pitch(void *dst, void *src, int w, int h, int srcpitch, int dstpitch)
{
- byte *dp = (byte*)d;
- byte *sp = (byte*)s;
+ byte *dstp = (byte*)dst;
+ byte *srcp = (byte*)src;
assert(h >= 0);
for (; h != 0; --h) {
- memcpy(dp, sp, w);
- dp += dpitch;
- sp += spitch;
+ memcpy(dstp, srcp, w);
+ dstp += dstpitch;
+ srcp += srcpitch;
}
}
-
void GfxScroll(int left, int top, int width, int height, int xo, int yo)
{
const Pixel *src;
@@ -583,7 +580,14 @@ BoundingRect GetStringBoundingBox(const char *str)
return br;
}
-
+/** Draw a string at the given coordinates with the given colour
+ * @param string the string to draw
+ * @param x offset from left side of the screen, if negative offset from the right side
+ * @param x offset from top side of the screen, if negative offset from the bottom
+ * @param real_color colour of the string, see _string_colormap in
+ * table/palettes.h or docs/ottd-colourtext-palette.png
+ * @return the x-coordinates where the drawing has finished. If nothing is drawn
+ * the originally passed x-coordinate is returned */
int DoDrawString(const char *string, int x, int y, uint16 real_color)
{
DrawPixelInfo *dpi = _cur_dpi;