summaryrefslogtreecommitdiff
path: root/src/Graphics.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-19 13:44:59 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-19 13:44:59 (GMT)
commit44639a6423c03552a3c0faafab27ef8f395f73a6 (patch)
tree1a4fc49a56060759fcbec6f18e9159cf126e8606 /src/Graphics.cpp
parent4a60b97c700c2f1843b7e99313554cb89fb5da4e (diff)
downloadpowder-44639a6423c03552a3c0faafab27ef8f395f73a6.zip
powder-44639a6423c03552a3c0faafab27ef8f395f73a6.tar.gz
Some folder changes, started search and client
Diffstat (limited to 'src/Graphics.cpp')
-rw-r--r--src/Graphics.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/Graphics.cpp b/src/Graphics.cpp
index 52fa4c9..65d198f 100644
--- a/src/Graphics.cpp
+++ b/src/Graphics.cpp
@@ -19,13 +19,13 @@
#endif
#include "Config.h"
-#include "air.h"
-#include "gravity.h"
+//#include "simulation/Air.h"
+//#include "simulation/Gravity.h"
//#include "powder.h"
-#define INCLUDE_PSTRUCT
-#include "Simulation.h"
-#include "Graphics.h"
-#include "ElementGraphics.h"
+//#define INCLUDE_PSTRUCT
+//#include "Simulation.h"
+//#include "Graphics.h"
+//#include "ElementGraphics.h"
#define INCLUDE_FONTDATA
#include "font.h"
#include "misc.h"
@@ -1501,15 +1501,24 @@ void Graphics::draw_image(pixel *img, int x, int y, int w, int h, int a)
{
int i, j, r, g, b;
if (!img) return;
- for (j=0; j<h; j++)
- for (i=0; i<w; i++)
- {
- r = PIXR(*img);
- g = PIXG(*img);
- b = PIXB(*img);
- drawpixel(x+i, y+j, r, g, b, a);
- img++;
- }
+ if(y + h > YRES+MENUSIZE) h = (YRES+MENUSIZE)-y; //Adjust height to prevent drawing off the bottom
+ if(a >= 255)
+ for (j=0; j<h; j++)
+ for (i=0; i<w; i++)
+ {
+ vid[(y+j)*(XRES+BARSIZE)+(x+i)] = *img;
+ img++;
+ }
+ else
+ for (j=0; j<h; j++)
+ for (i=0; i<w; i++)
+ {
+ r = PIXR(*img);
+ g = PIXG(*img);
+ b = PIXB(*img);
+ drawpixel(x+i, y+j, r, g, b, a);
+ img++;
+ }
}
void Graphics::dim_copy(pixel *dst, pixel *src) //old persistent, unused