[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src result.hxx,1.5,1.6 result_screen.cxx
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src result.hxx,1.5,1.6 result_screen.cxx,1.1,1.2 |
Date: |
16 Mar 2003 22:54:35 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv8444
Modified Files:
result.hxx result_screen.cxx
Log Message:
- some more stuff for the result screen, should be nearly fully functional now,
but is still pretty ugly
Index: result.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/result.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- result.hxx 10 Mar 2003 11:29:49 -0000 1.5
+++ result.hxx 16 Mar 2003 22:54:32 -0000 1.6
@@ -20,17 +20,31 @@
#ifndef HEADER_PINGUS_RESULT_HXX
#define HEADER_PINGUS_RESULT_HXX
+#include "plf_handle.hxx"
#include "pingus.hxx"
/** Result of a Pingus game */
struct Result
{
+ /** Leveldata */
+ PLFHandle plf;
+
+ /** Total number of that got saved */
int saved;
+
+ /** Total number of that got killed */
int killed;
+
+ /** Total number of Pingus */
int total;
- int time;
- int unknown;
- int status;
+
+ /** Time used to finish this level */
+ int used_time;
+
+ /** Maximum time available for this level */
+ int max_time;
+
+ /** Number of Pingus needed to save */
int needed;
};
Index: result_screen.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/result_screen.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- result_screen.cxx 10 Mar 2003 11:29:49 -0000 1.1
+++ result_screen.cxx 16 Mar 2003 22:54:32 -0000 1.2
@@ -23,9 +23,21 @@
#include "gui/screen_manager.hxx"
#include "res_descriptor.hxx"
#include "fonts.hxx"
+#include "plf.hxx"
#include "string_converter.hxx"
+#include "game_session.hxx"
+#include "system.hxx"
#include "result_screen.hxx"
+class ResultScreenComponent : public GUI::Component
+{
+public:
+ Result result;
+
+ ResultScreenComponent(Result arg_result);
+ void draw(GraphicContext& gc) ;
+};
+
class ResultScreenOkButton
: public GUI::SurfaceButton
{
@@ -44,31 +56,69 @@
}
};
-class ResultComponent : public GUI::Component
+class ResultScreenRetryButton
+ : public GUI::SurfaceButton
{
private:
- Result result;
+ ResultScreenComponent* parent;
public:
- ResultComponent(Result arg_result)
- : result(arg_result)
+ ResultScreenRetryButton(ResultScreenComponent* p)
+ : GUI::SurfaceButton(500, 500,
+ ResDescriptor("result/retry", "core",
ResDescriptor::RD_RESOURCE),
+ ResDescriptor("result/retry", "core",
ResDescriptor::RD_RESOURCE),
+ ResDescriptor("result/retry", "core",
ResDescriptor::RD_RESOURCE)),
+ parent(p)
{
}
- void draw(GraphicContext& gc) {
- gc.print_left(Fonts::pingus_small, 100, 100, "Saved: ");
- gc.print_left(Fonts::pingus_small, 200, 100, to_string(result.saved));
- gc.print_left(Fonts::pingus_small, 100, 130, "Killed: ");
- gc.print_left(Fonts::pingus_small, 200, 130, to_string(result.killed));
+ void on_click()
+ {
+ std::cout << "Got CLICK on Retry!!!" << std::endl;
+ ScreenManager::instance()->replace_screen(new PingusGameSession
(parent->result.plf), true);
}
};
+ResultScreenComponent::ResultScreenComponent(Result arg_result)
+ : result(arg_result)
+{
+}
+
+void
+ResultScreenComponent::draw(GraphicContext& gc)
+{
+ gc.clear(.0f, .0f, .0f);
+ gc.print_center(Fonts::pingus_large, gc.get_width()/2, 20, "Results for ");
+ gc.print_center(Fonts::pingus_large, gc.get_width()/2, 70,
System::translate(result.plf->get_levelname()));
+
+ gc.print_left(Fonts::pingus_small, 100, 180, "Saved: ");
+ gc.print_left(Fonts::pingus_small, 200, 180, to_string(result.saved));
+ gc.print_left(Fonts::pingus_small, 100, 210, "Killed: ");
+ gc.print_left(Fonts::pingus_small, 200, 210, to_string(result.killed));
+
+ gc.print_left(Fonts::pingus_small, 100, 240, "Needed: ");
+ gc.print_left(Fonts::pingus_small, 200, 240, to_string(result.needed));
+
+ gc.print_left(Fonts::pingus_small, 100, 270, "Time left: ");
+ if (result.max_time == -1)
+ gc.print_left(Fonts::pingus_small, 200, 270, "-");
+ else
+ gc.print_left(Fonts::pingus_small, 200, 270, to_string(result.max_time -
result.used_time));
+
+ if (result.saved >= result.needed)
+ gc.print_center(Fonts::pingus_large, gc.get_width()/2, 350, "Success!
=:-)");
+ else
+ gc.print_center(Fonts::pingus_large, gc.get_width()/2, 350, "Failure!
:-(");
+}
+
ResultScreen::ResultScreen(Result result)
{
ResDescriptor ok_desc("result/ok", "core", ResDescriptor::RD_RESOURCE);
ResDescriptor cancel_desc("result/retry", "core",
ResDescriptor::RD_RESOURCE);
- gui_manager->add(new ResultComponent(result));
+ ResultScreenComponent* comp = new ResultScreenComponent(result);
+ gui_manager->add(comp);
gui_manager->add(new ResultScreenOkButton());
+ gui_manager->add(new ResultScreenRetryButton(comp));
//gui_manager->add(new GUI::SurfaceButton(500, 500, cancel_desc,
cancel_desc, cancel_desc));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src result.hxx,1.5,1.6 result_screen.cxx,1.1,1.2,
grumbel <=