diff options
| author | Simon <simon@hardwired.org.uk> | 2010-08-26 11:20:16 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2010-08-26 11:20:16 (GMT) |
| commit | 72a1d17fe42ccc74ac25328dcd272b7a2bf6856c (patch) | |
| tree | a064555f1694f7c763eb3f42c56fe92ea016713b | |
| parent | 5751fea35f31640fddfaea1459503e366ae39729 (diff) | |
| download | powder-72a1d17fe42ccc74ac25328dcd272b7a2bf6856c.zip powder-72a1d17fe42ccc74ac25328dcd272b7a2bf6856c.tar.gz | |
This build works, but still a work in progress
| -rw-r--r-- | defines.h | 4 | ||||
| -rw-r--r-- | graphics.c | 8 | ||||
| -rw-r--r-- | misc.c | 41 | ||||
| -rw-r--r-- | misc.h | 23 | ||||
| -rw-r--r-- | powder.c | 13 | ||||
| -rwxr-xr-x | version.h | 4 |
6 files changed, 67 insertions, 26 deletions
@@ -5,11 +5,7 @@ #undef PLOSS -#ifdef MENUV3 #define MENUSIZE 40 -#else -#define MENUSIZE 20 -#endif #define BARSIZE 14 #define XRES 612 #define YRES 384 @@ -3,7 +3,7 @@ #include "powder.h" #include "graphics.h" #include "font.h" -#include "utils.h" +#include "misc.h" #include <math.h> #include <SDL/SDL.h> @@ -716,9 +716,6 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) void draw_menu(pixel *vid_buf, int i, int hover) { - - //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); -#ifdef MENUV3 drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); if(hover==i) { @@ -729,9 +726,6 @@ void draw_menu(pixel *vid_buf, int i, int hover) { drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); } -#else - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); -#endif } #ifdef WIN32 @@ -0,0 +1,41 @@ +#include "misc.h" + +//Signum function +#ifdef WIN32 +_inline int sign(float i) +#else +inline int sign(float i) +#endif +{ + if (i<0) + return -1; + if (i>0) + return 1; + return 0; +} + +#ifdef WIN32 +_inline unsigned clamp_flt(float f, float min, float max) +#else +inline unsigned clamp_flt(float f, float min, float max) +#endif +{ + if(f<min) + return 0; + if(f>max) + return 255; + return (int)(255.0f*(f-min)/(max-min)); +} + +#ifdef WIN32 +_inline float restrict_flt(float f, float min, float max) +#else +inline float restrict_flt(float f, float min, float max) +#endif +{ + if(f<min) + return min; + if(f>max) + return max; + return f; +}
\ No newline at end of file @@ -0,0 +1,23 @@ +#ifndef UTILS_H +#define UTILS_H + +//Signum function +#ifdef WIN32 +extern _inline int sign(float i); +#else +extern inline int sign(float i); +#endif + +#ifdef WIN32 +extern _inline unsigned clamp_flt(float f, float min, float max); +#else +extern inline unsigned clamp_flt(float f, float min, float max); +#endif + +#ifdef WIN32 +extern _inline float restrict_flt(float f, float min, float max); +#else +extern inline float restrict_flt(float f, float min, float max); +#endif + +#endif
\ No newline at end of file @@ -37,7 +37,7 @@ #include <unistd.h> #endif -#include "utils.h" +#include "misc.h" #include "font.h" #include "defines.h" #include "powder.h" @@ -8619,15 +8619,7 @@ int main(int argc, char *argv[]) { draw_menu(vid_buf, i, active_menu); } -#ifndef MENUV3 - for(i=0; i<SC_TOTAL; i++) - { - if(!b&&x>=sdl_scale*(XRES+1) && x<sdl_scale*(XRES+BARSIZE-1) &&y>= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y<sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)+12)) - { - menu_ui(vid_buf, i, &sl, &sr); - } - } -#else + for(i=0; i<SC_TOTAL; i++) { if(!b&&x>=sdl_scale*(XRES-2) && x<sdl_scale*(XRES+BARSIZE-1) &&y>= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y<sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)+15)) @@ -8636,7 +8628,6 @@ int main(int argc, char *argv[]) } } menu_ui_v3(vid_buf, active_menu, &sl, &sr, b, bq, x, y); -#endif if(zoom_en && x>=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy && x<sdl_scale*(zoom_wx+ZFACTOR*ZSIZE) @@ -24,8 +24,4 @@ #define MINOR_VERSION 3 #define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter. -#define MENUV3 -//#define BETA -#define HEAT_ENABLE - #endif |
