src/gfx.h
branchnoai
changeset 9703 d2a6acdbd665
parent 9701 d1ac22c62f64
child 9704 197cb8c6ae17
--- a/src/gfx.h	Sun Sep 09 21:14:29 2007 +0000
+++ b/src/gfx.h	Sun Sep 23 07:37:38 2007 +0000
@@ -2,6 +2,36 @@
 
 /** @file gfx.h */
 
+/**
+ * @defgroup dirty Dirty
+ *
+ * Handles the repaint of some part of the screen.
+ *
+ * Some places in the code are called functions which makes something "dirty".
+ * This has nothing to do with making a Tile or Window darker or less visible.
+ * This term comes from memory caching and is used to define an object must
+ * be repaint. If some data of an object (like a Tile, Window, Vehicle, whatever)
+ * are changed which are so extensive the object must be repaint its marked
+ * as "dirty". The video driver repaint this object instead of the whole screen
+ * (this is btw. also possible if needed). This is used to avoid a
+ * flickering of the screen by the video driver constantly repainting it.
+ *
+ * This whole mechanism is controlled by an rectangle defined in #_invalid_rect. This
+ * rectangle defines the area on the screen which must be repaint. If a new object
+ * needs to be repainted this rectangle is extended to 'catch' the object on the
+ * screen. At some point (which is normaly uninteressted for patch writers) this
+ * rectangle is send to the video drivers method
+ * VideoDriver::MakeDirty and it is truncated back to an empty rectangle. At some
+ * later point (which is uninteressted, too) the video driver
+ * repaints all these saved rectangle instead of the whole screen and drop the
+ * rectangle informations. Then a new round begins by marking objects "dirty".
+ *
+ * @see VideoDriver::MakeDirty
+ * @see _invalid_rect
+ * @see _screen
+ */
+
+
 #ifndef GFX_H
 #define GFX_H
 
@@ -36,24 +66,6 @@
 	WKC_RETURN      = 13,
 	WKC_TAB         = 14,
 
-	/* Numerical keyboard */
-	WKC_NUM_0       = 16,
-	WKC_NUM_1       = 17,
-	WKC_NUM_2       = 18,
-	WKC_NUM_3       = 19,
-	WKC_NUM_4       = 20,
-	WKC_NUM_5       = 21,
-	WKC_NUM_6       = 22,
-	WKC_NUM_7       = 23,
-	WKC_NUM_8       = 24,
-	WKC_NUM_9       = 25,
-	WKC_NUM_DIV     = 26,
-	WKC_NUM_MUL     = 27,
-	WKC_NUM_MINUS   = 28,
-	WKC_NUM_PLUS    = 29,
-	WKC_NUM_ENTER   = 30,
-	WKC_NUM_DECIMAL = 31,
-
 	/* Space */
 	WKC_SPACE       = 32,
 
@@ -81,20 +93,35 @@
 	 * A-Z are mapped to 65-90
 	 * a-z are mapped to 97-122 */
 
-	/* Other keys, corresponding to their ascii values */
-	WKC_SLASH       = 47, ///< / Forward slash
-	WKC_SEMICOLON   = 59, ///< ; Semicolon
-	WKC_EQUALS      = 61, ///< = Equals
-	WKC_L_BRACKET   = 91, ///< [ Left square bracket
-	WKC_BACKSLASH   = 92, ///< \ Backslash
-	WKC_R_BRACKET   = 93, ///< ] Right square bracket
+	/* Numerical keyboard */
+	WKC_NUM_0       = 128,
+	WKC_NUM_1       = 129,
+	WKC_NUM_2       = 130,
+	WKC_NUM_3       = 131,
+	WKC_NUM_4       = 132,
+	WKC_NUM_5       = 133,
+	WKC_NUM_6       = 134,
+	WKC_NUM_7       = 135,
+	WKC_NUM_8       = 136,
+	WKC_NUM_9       = 137,
+	WKC_NUM_DIV     = 138,
+	WKC_NUM_MUL     = 139,
+	WKC_NUM_MINUS   = 140,
+	WKC_NUM_PLUS    = 141,
+	WKC_NUM_ENTER   = 142,
+	WKC_NUM_DECIMAL = 143,
 
-	/* Other keys of which their ascii value is already taken
-	 * - use unused ascii value not present on keyboard directly */
-	WKC_SINGLEQUOTE = 58, ///< ' Single quote
-	WKC_COMMA       = 60, ///< , Comma
-	WKC_PERIOD      = 62, ///< . Period
-	WKC_MINUS       = 95, ///< - Minus
+	/* Other keys */
+	WKC_SLASH       = 144, ///< / Forward slash
+	WKC_SEMICOLON   = 145, ///< ; Semicolon
+	WKC_EQUALS      = 146, ///< = Equals
+	WKC_L_BRACKET   = 147, ///< [ Left square bracket
+	WKC_BACKSLASH   = 148, ///< \ Backslash
+	WKC_R_BRACKET   = 149, ///< ] Right square bracket
+	WKC_SINGLEQUOTE = 150, ///< ' Single quote
+	WKC_COMMA       = 151, ///< , Comma
+	WKC_PERIOD      = 152, ///< . Period
+	WKC_MINUS       = 153, ///< - Minus
 };
 
 enum GameModes {
@@ -247,8 +274,26 @@
 void LoadStringWidthTable();
 void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
 uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh = -1);
+
+/**
+ * Let the dirty blocks repainting by the video driver.
+ *
+ * @ingroup dirty
+ */
 void DrawDirtyBlocks();
+
+/**
+ * Set a new dirty block.
+ *
+ * @ingroup dirty
+ */
 void SetDirtyBlocks(int left, int top, int right, int bottom);
+
+/**
+ * Marks the whole screen as dirty.
+ *
+ * @ingroup dirty
+ */
 void MarkWholeScreenDirty();
 
 void GfxInitPalettes();