This build works, but still a work in progress

This commit is contained in:
Simon 2010-08-26 12:20:16 +01:00
parent 5751fea35f
commit 72a1d17fe4
6 changed files with 67 additions and 26 deletions

View File

@ -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

View File

@ -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

41
misc.c Normal file
View File

@ -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;
}

23
misc.h Normal file
View 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

View 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)

View File

@ -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