Cleanup some math stuff

This commit is contained in:
Adubbz 2018-02-25 12:43:19 +11:00
parent 29ad386bef
commit 7f905cd9dc
3 changed files with 4 additions and 10 deletions

View File

@ -52,7 +52,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS := -g $(ARCH) ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lnx LIBS := -lnx -lm
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing # list of directories containing libraries, this must be the top level containing

View File

@ -5,12 +5,7 @@ float approxSin(float x) {
float ret; float ret;
// always wrap input angle to -PI..PI // always wrap input angle to -PI..PI
while (x<-3.14159265 || x>3.14159265) { x = fmod(x, M_PI*2.0)-M_PI;
if (x<-3.14159265)
x += 6.28318531;
else if (x >3.14159265)
x -= 6.28318531;
}
// compute sine // compute sine
if (x<0) if (x<0)

View File

@ -68,12 +68,11 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
int shadow_inset; int shadow_inset;
color_t shadow_color; color_t shadow_color;
uint8_t shadow_alpha_base = 80; uint8_t shadow_alpha_base = 80;
float highlight_multiplier, highlight_mod; float highlight_multiplier;
int shadow_size = 4; int shadow_size = 4;
if (is_active) { if (is_active) {
highlight_mod = timer - 1.0 * (int)(timer / 1.0); highlight_multiplier = fmax(0.0, fabs(fmod(timer, 1.0) - 0.5) / 0.5);
highlight_multiplier = fmax(0.0, fabs(highlight_mod - 0.5) / 0.5);
border_color = MakeColor(themeCurrent.highlightColor.r + (255 - themeCurrent.highlightColor.r) * highlight_multiplier, themeCurrent.highlightColor.g + (255 - themeCurrent.highlightColor.g) * highlight_multiplier, themeCurrent.highlightColor.b + (255 - themeCurrent.highlightColor.b) * highlight_multiplier, 255); border_color = MakeColor(themeCurrent.highlightColor.r + (255 - themeCurrent.highlightColor.r) * highlight_multiplier, themeCurrent.highlightColor.g + (255 - themeCurrent.highlightColor.g) * highlight_multiplier, themeCurrent.highlightColor.b + (255 - themeCurrent.highlightColor.b) * highlight_multiplier, 255);
border_start_x = start_x-5; border_start_x = start_x-5;
border_end_x = end_x+5; border_end_x = end_x+5;