[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldmap level_dot.cxx, 1.23, 1.24
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldmap level_dot.cxx, 1.23, 1.24 |
Date: |
23 Aug 2003 18:14:35 -0000 |
Update of /var/lib/cvs/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv4963/worldmap
Modified Files:
level_dot.cxx
Log Message:
prevent level name from reaching out of screen
Index: level_dot.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/worldmap/level_dot.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- level_dot.cxx 24 Apr 2003 15:18:19 -0000 1.23
+++ level_dot.cxx 23 Aug 2003 18:14:33 -0000 1.24
@@ -19,6 +19,7 @@
#include <iostream>
#include <math.h>
+#include <ClanLib/Display/Font/font.h>
#include "../input/controller.hxx"
#include "../input/pointer.hxx"
#include "../gettext.h"
@@ -146,19 +147,38 @@
return false;
}
+
void
LevelDot::draw_hover(GraphicContext& gc)
{
+ int pos_correction = 0;
+
if (accessible())
{
+ int length =
Fonts::pingus_small->get_text_width(System::translate(get_plf()->get_levelname()))
/ 2;
+ int realpos = static_cast<int>(gc.world_to_screen(Vector(pos.x, pos.y,
0)).x);
+ if (realpos - length < 0)
+ pos_correction = realpos - length;
+ else if (realpos + length > gc.get_width())
+ pos_correction = realpos + length - gc.get_width();
+
gc.print_center(Fonts::pingus_small,
- int(pos.x), int(pos.y - 40),
+ static_cast<int>(pos.x) - pos_correction,
+ static_cast<int>(pos.y - 40),
System::translate(get_plf()->get_levelname()));
}
else
{
+ int length = Fonts::pingus_small->get_text_width(_("locked")) / 2;
+ int realpos = static_cast<int>(gc.world_to_screen(Vector(pos.x, pos.y,
0)).x);
+ if (realpos - length < 0)
+ pos_correction = realpos - length;
+ else if (realpos + length > gc.get_width())
+ pos_correction = realpos + length - gc.get_width();
+
gc.print_center(Fonts::pingus_small,
- int(pos.x), int(pos.y - 30),
+ static_cast<int>(pos.x) - pos_correction,
+ static_cast<int>(pos.y - 30),
_("locked"));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldmap level_dot.cxx, 1.23, 1.24,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/data/levels/playable columns-luca.plf, NONE, 1.1 columns-luca.xml, 1.1, NONE
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/data/images Makefile.am,1.54,1.55
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/data/levels/playable columns-luca.plf, NONE, 1.1 columns-luca.xml, 1.1, NONE
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/data/images Makefile.am,1.54,1.55
- Index(es):