projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
No more count-to-infinity for the coins display
[supertux.git]
/
src
/
player_status.cpp
diff --git
a/src/player_status.cpp
b/src/player_status.cpp
index
f638bca
..
44512a1
100644
(file)
--- a/
src/player_status.cpp
+++ b/
src/player_status.cpp
@@
-19,6
+19,7
@@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
+#include <math.h>
#include "lisp/writer.hpp"
#include "lisp/lisp.hpp"
#include "player_status.hpp"
#include "lisp/writer.hpp"
#include "lisp/lisp.hpp"
#include "player_status.hpp"
@@
-135,7
+136,9
@@
PlayerStatus::draw(DrawingContext& context)
static int displayed_coins = -1;
static int next_count = 0;
static int displayed_coins = -1;
static int next_count = 0;
- if (displayed_coins == -1) displayed_coins = coins;
+ if ((displayed_coins == -1) || (fabsf(displayed_coins - coins) > 100)) {
+ displayed_coins = coins;
+ }
if (++next_count > 2) {
next_count = 0;
if (displayed_coins < coins) displayed_coins++;
if (++next_count > 2) {
next_count = 0;
if (displayed_coins < coins) displayed_coins++;
@@
-152,9
+155,9
@@
PlayerStatus::draw(DrawingContext& context)
Surface* coin_surf = coin_surface.get();
if (coin_surf) {
Surface* coin_surf = coin_surface.get();
if (coin_surf) {
- context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - gold_text->get_text_width(coins_text), BORDER_Y + 1), LAYER_
FOREGROUND1);
+ context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - gold_text->get_text_width(coins_text), BORDER_Y + 1), LAYER_
HUD);
}
}
- context.draw_text(gold_text, coins_text, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y), RIGHT_ALLIGN, LAYER_
FOREGROUND1
);
+ context.draw_text(gold_text, coins_text, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y), RIGHT_ALLIGN, LAYER_
HUD
);
context.pop_transform();
}
context.pop_transform();
}