(Lakka) Style nits and update headers

This commit is contained in:
twinaphex 2014-05-09 23:50:40 +02:00
parent 6c2c7ade7d
commit a359045da3
3 changed files with 46 additions and 17 deletions

View File

@ -1,3 +1,20 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
* Copyright (C) 2014 - Jean-André Santoni
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MENU_DISP_LAKKA_H
#define _MENU_DISP_LAKKA_H

View File

@ -1,6 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
* Copyright (C) 2011-2013 - Daniel De Matteis
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
* Copyright (C) 2014 - Jean-André Santoni
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
@ -29,7 +30,8 @@ float inOutQuad(float t, float b, float c, float d)
return -c / 2 * ((t - 1) * (t - 3) - 1) + b;
}
void add_tween(float duration, float target_value, float* subject, easingFunc easing) {
void add_tween(float duration, float target_value, float* subject, easingFunc easing)
{
numtweens++;
tweens = realloc(tweens, numtweens * sizeof(tween));
tweens[numtweens-1].alive = 1;
@ -43,33 +45,37 @@ void add_tween(float duration, float target_value, float* subject, easingFunc ea
void update_tweens(float dt)
{
int active_tweens = 0;
for(int i = 0; i < numtweens; i++)
int i, active_tweens;
active_tweens = 0;
for(i = 0; i < numtweens; i++)
{
tweens[i] = update_tween(tweens[i], dt);
active_tweens += tweens[i].running_since < tweens[i].duration ? 1 : 0;
}
if (numtweens && !active_tweens) {
if (numtweens && !active_tweens)
numtweens = 0;
}
}
tween update_tween(tween tw, float dt)
{
if (tw.running_since < tw.duration) {
if (tw.running_since < tw.duration)
{
tw.running_since += dt;
*(tw.subject) = tw.easing(
tw.running_since,
tw.initial_value,
tw.target_value - tw.initial_value,
tw.duration);
tw.running_since,
tw.initial_value,
tw.target_value - tw.initial_value,
tw.duration);
if (tw.running_since >= tw.duration)
*(tw.subject) = tw.target_value;
}
return tw;
}
void free_tweens()
void free_tweens(void)
{
free(tweens);
if (tweens)
free(tweens);
}

View File

@ -1,6 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
* Copyright (C) 2011-2013 - Daniel De Matteis
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
* Copyright (C) 2014 - Jean-André Santoni
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
@ -14,6 +15,9 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _LAKKA_TWEEN_H
#define _LAKKA_TWEEN_h
#include "math.h"
typedef float (*easingFunc)(float, float, float, float);
@ -34,4 +38,6 @@ typedef struct
tween update_tween(tween, float);
void update_tweens(float);
void add_tween(float, float, float*, easingFunc);
void free_tweens();
void free_tweens();
#endif