[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2541 - trunk/src
From: |
jave27 |
Subject: |
[Pingus-CVS] r2541 - trunk/src |
Date: |
Mon, 5 Dec 2005 22:52:19 +0100 |
Author: jave27
Date: 2005-12-05 22:52:15 +0100 (Mon, 05 Dec 2005)
New Revision: 2541
Modified:
trunk/src/file_dialog_item.cxx
trunk/src/file_dialog_item.hxx
Log:
Prettied up the file dialog some more. It retrieves level info now.
Modified: trunk/src/file_dialog_item.cxx
===================================================================
--- trunk/src/file_dialog_item.cxx 2005-12-05 21:25:00 UTC (rev 2540)
+++ trunk/src/file_dialog_item.cxx 2005-12-05 21:52:15 UTC (rev 2541)
@@ -19,11 +19,14 @@
#include <ClanLib/Display/sprite.h>
#include <ClanLib/Core/IOData/directory_scanner.h>
+#include <ClanLib/Core/System/clanstring.h>
#include "file_dialog_item.hxx"
#include "file_dialog.hxx"
#include "vector.hxx"
#include "fonts.hxx"
#include "resource.hxx"
+#include "xml_pingus_level.hxx"
+#include "gettext.h"
namespace Pingus {
@@ -45,7 +48,21 @@
if (file_item.is_directory)
sprite = Resource::load_sprite("core/menu/folder");
else
+ {
+ // FIXME: Load thumbnail specific to this level
sprite =
Resource::load_sprite("core/menu/default_level");
+
+ // Load information about this file if possible.
+ if (file_dialog->get_file_mask() == ".pingus")
+ {
+ // Get level information
+ XMLPingusLevel level("",
file_dialog->get_path() + file_item.name);
+ friendly_name = _(level.get_levelname());
+ // Have to limit the size of the printed name
+ friendly_name = friendly_name.substr(0, 23);
+ file_info = _("Difficulty: ") +
CL_String::to(level.get_difficulty());
+ }
+ }
}
bool
@@ -69,9 +86,12 @@
gc.print_left(Fonts::pingus_small, pos.x +
(float)sprite.get_width(),
pos.y, get_filename());
- // FIXME: If mouse over, draw a quick info box about
the level
- if (mouse_over)
+ // FIXME: If mouse over, draw a quick info box about
the file item
+ if (mouse_over && !file_item.is_directory)
{
+ gc.draw_fillrect(pos.x+50, pos.y, pos.x+300,
pos.y+50, CL_Color::azure);
+ gc.print_left(Fonts::pingus_small, pos.x+50,
pos.y, friendly_name);
+ gc.print_left(Fonts::pingus_small, pos.x+50,
pos.y+25, file_info);
}
}
}
Modified: trunk/src/file_dialog_item.hxx
===================================================================
--- trunk/src/file_dialog_item.hxx 2005-12-05 21:25:00 UTC (rev 2540)
+++ trunk/src/file_dialog_item.hxx 2005-12-05 21:52:15 UTC (rev 2541)
@@ -35,6 +35,9 @@
bool mouse_over;
bool is_hidden;
+ std::string friendly_name;
+ std::string file_info;
+
FileDialog* file_dialog;
Vector pos;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2541 - trunk/src,
jave27 <=