This build works, but still a work in progress
This commit is contained in:
parent
5751fea35f
commit
72a1d17fe4
@ -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
|
||||
|
41
misc.c
Normal file
41
misc.c
Normal 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
23
misc.h
Normal 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
|
13
powder.c
13
powder.c
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user