Skip to content

Commit

Permalink
Cleanup some math stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Adubbz authored and plutooo committed Feb 26, 2018
1 parent d7396de commit 0981e34
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile.nx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS := -g $(ARCH)
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
Expand Down
7 changes: 1 addition & 6 deletions common/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ float approxSin(float x) {
float ret;

// always wrap input angle to -PI..PI
while (x<-3.14159265 || x>3.14159265) {
if (x<-3.14159265)
x += 6.28318531;
else if (x >3.14159265)
x -= 6.28318531;
}
x = fmod(x, M_PI*2.0)-M_PI;

// compute sine
if (x<0)
Expand Down
5 changes: 2 additions & 3 deletions common/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
int shadow_inset;
color_t shadow_color;
uint8_t shadow_alpha_base = 80;
float highlight_multiplier, highlight_mod;
float highlight_multiplier;
int shadow_size = 4;

if (is_active) {
highlight_mod = timer - 1.0 * (int)(timer / 1.0);
highlight_multiplier = fmax(0.0, fabs(highlight_mod - 0.5) / 0.5);
highlight_multiplier = fmax(0.0, fabs(fmod(timer, 1.0) - 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_start_x = start_x-5;
border_end_x = end_x+5;
Expand Down

0 comments on commit 0981e34

Please sign in to comment.