summaryrefslogtreecommitdiff
path: root/src/graphic
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphic')
-rw-r--r--src/graphic/graphic.cpp11
-rw-r--r--src/graphic/graphic.h33
2 files changed, 42 insertions, 2 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 281c3c89..bc982b6c 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -200,8 +200,19 @@ void Graphics::drawImageRect(
y + h - bottomRight->getHeight());
}
+void Graphics::drawImageRect(
+ int x, int y, int w, int h,
+ const ImageRect &imgRect)
+{
+ drawImageRect(x, y, w, h,
+ imgRect.grid[0], imgRect.grid[2], imgRect.grid[6], imgRect.grid[8],
+ imgRect.grid[1], imgRect.grid[5], imgRect.grid[7], imgRect.grid[3],
+ imgRect.grid[4]);
+}
+
void Graphics::updateScreen()
{
+ //SDL_Flip();
blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
}
diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h
index 5b61bb28..1887a77b 100644
--- a/src/graphic/graphic.h
+++ b/src/graphic/graphic.h
@@ -88,6 +88,27 @@ class BuySellListener : public gcn::ActionListener {
};
/**
+ * 9 images defining a rectangle. 4 corners, 4 sides and a middle area. The
+ * topology is as follows:
+ *
+ * <pre>
+ * !-----!-----------------!-----!
+ * ! 0 ! 1 ! 2 !
+ * !-----!-----------------!-----!
+ * ! 3 ! 4 ! 5 !
+ * !-----!-----------------!-----!
+ * ! 6 ! 7 ! 8 !
+ * !-----!-----------------!-----!
+ * </pre>
+ *
+ * Sections 0, 2, 6 and 8 will remain as is. 1, 3, 4, 5 and 7 will be
+ * repeated to fit the size of the widget.
+ */
+struct ImageRect {
+ Image *grid[9];
+};
+
+/**
* A central point of control for graphics.
*/
class Graphics : public gcn::AllegroGraphics {
@@ -103,8 +124,8 @@ class Graphics : public gcn::AllegroGraphics {
~Graphics();
/**
- * Draws a rectangle using 4 corner images, 4 side images and 1 image
- * for the inside.
+ * Draws a rectangle using images. 4 corner images, 4 side images and 1
+ * image for the inside.
*/
void drawImageRect(
int x, int y, int w, int h,
@@ -115,6 +136,14 @@ class Graphics : public gcn::AllegroGraphics {
Image *center);
/**
+ * Draws a rectangle using images. 4 corner images, 4 side images and 1
+ * image for the inside.
+ */
+ void drawImageRect(
+ int x, int y, int w, int h,
+ const ImageRect &imgRect);
+
+ /**
* Updates the screen. This is done by either copying the buffer to the
* screen or swapping pages.
*/