[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src result_screen.cxx,NONE,1.1 result_scr
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src result_screen.cxx,NONE,1.1 result_screen.hxx,NONE,1.1 Makefile.am,1.136,1.137 game_session.cxx,1.31,1.32 res_descriptor.cxx,1.12,1.13 res_descriptor.hxx,1.9,1.10 result.hxx,1.4,1.5 |
Date: |
10 Mar 2003 11:29:52 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv13072
Modified Files:
Makefile.am game_session.cxx res_descriptor.cxx
res_descriptor.hxx result.hxx
Added Files:
result_screen.cxx result_screen.hxx
Log Message:
added framework for result screen
--- NEW FILE: result_screen.cxx ---
// $Id: result_screen.cxx,v 1.1 2003/03/10 11:29:49 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
//
// This program 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 Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
#include "gui/surface_button.hxx"
#include "gui/gui_manager.hxx"
#include "gui/screen_manager.hxx"
#include "res_descriptor.hxx"
#include "fonts.hxx"
#include "string_converter.hxx"
#include "result_screen.hxx"
class ResultScreenOkButton
: public GUI::SurfaceButton
{
public:
ResultScreenOkButton()
: GUI::SurfaceButton(100, 500,
ResDescriptor("result/ok", "core",
ResDescriptor::RD_RESOURCE),
ResDescriptor("result/ok", "core",
ResDescriptor::RD_RESOURCE),
ResDescriptor("result/ok", "core",
ResDescriptor::RD_RESOURCE))
{
}
void on_click() {
std::cout << "Got CLICK!!!" << std::endl;
ScreenManager::instance()->pop_screen();
}
};
class ResultComponent : public GUI::Component
{
private:
Result result;
public:
ResultComponent(Result arg_result)
: result(arg_result)
{
}
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));
}
};
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));
gui_manager->add(new ResultScreenOkButton());
//gui_manager->add(new GUI::SurfaceButton(500, 500, cancel_desc, cancel_desc,
cancel_desc));
}
/* EOF */
--- NEW FILE: result_screen.hxx ---
// $Id: result_screen.hxx,v 1.1 2003/03/10 11:29:49 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
//
// This program 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 Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_PINGUS_RESULT_SCREEN_HXX
#define HEADER_PINGUS_RESULT_SCREEN_HXX
#include "result.hxx"
#include "gui/gui_screen.hxx"
/** */
class ResultScreen : public GUIScreen
{
private:
public:
ResultScreen(Result result);
private:
ResultScreen (const ResultScreen&);
ResultScreen& operator= (const ResultScreen&);
};
#endif
/* EOF */
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Makefile.am,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- Makefile.am 4 Mar 2003 10:26:18 -0000 1.136
+++ Makefile.am 10 Mar 2003 11:29:49 -0000 1.137
@@ -238,6 +238,8 @@
resource_modifier.hxx \
result.cxx \
result.hxx \
+result_screen.cxx \
+result_screen.hxx \
screenshot.cxx \
screenshot.hxx \
server.cxx \
Index: game_session.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_session.cxx,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- game_session.cxx 4 Mar 2003 17:02:51 -0000 1.31
+++ game_session.cxx 10 Mar 2003 11:29:49 -0000 1.32
@@ -26,6 +26,7 @@
#include "timer.hxx"
#include "pingus_resource.hxx"
#include "plf.hxx"
+#include "result_screen.hxx"
#include "globals.hxx"
PingusGameSession::PingusGameSession (PLFHandle arg_plf)
@@ -93,7 +94,10 @@
// FIXME: Timing code could need another rewrite...
if (server->is_finished())
{
- ScreenManager::instance()->pop_screen();
+ //ScreenManager::instance()->pop_screen();
+ Result result;
+ ScreenManager::instance()->replace_screen(new ResultScreen(result));
+ return;
}
int time_passed = int(delta.get_time() * 1000) + left_over_time;
Index: res_descriptor.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/res_descriptor.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- res_descriptor.cxx 27 Sep 2002 11:26:44 -0000 1.12
+++ res_descriptor.cxx 10 Mar 2003 11:29:49 -0000 1.13
@@ -22,6 +22,13 @@
#include "res_descriptor.hxx"
#include "pingus_error.hxx"
+/*
+ uri -> file:///home/ingo/.pingus/images/...
+ uri -> resource://core/result/ok
+ uri -> file://bla.png (relative to ~/.pingus/images/)
+ ResDescriptor(const std::string& uri);
+*/
+
ResDescriptor::ResDescriptor()
{
type = RD_RESOURCE;
@@ -89,6 +96,7 @@
}
}
+#if 0
ResDescriptor::ResDescriptor(const std::string& c_cast, const std::string&
value)
{
modifier = ResourceModifierNS::ROT0;
@@ -113,6 +121,7 @@
}
res_name = value;
}
+#endif
bool
ResDescriptor::operator<(const ResDescriptor& res_desc) const
Index: res_descriptor.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/res_descriptor.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- res_descriptor.hxx 27 Sep 2002 11:26:44 -0000 1.9
+++ res_descriptor.hxx 10 Mar 2003 11:29:49 -0000 1.10
@@ -47,7 +47,6 @@
ResourceType type,
ResourceModifierNS::ResourceModifier modifier
= ResourceModifierNS::ROT0);
- ResDescriptor (const std::string& cast, const std::string& value);
ResDescriptor (const std::string& str);
bool operator< (const ResDescriptor&) const;
Index: result.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/result.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- result.hxx 23 Aug 2002 15:49:50 -0000 1.4
+++ result.hxx 10 Mar 2003 11:29:49 -0000 1.5
@@ -22,6 +22,7 @@
#include "pingus.hxx"
+/** Result of a Pingus game */
struct Result
{
int saved;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src result_screen.cxx,NONE,1.1 result_screen.hxx,NONE,1.1 Makefile.am,1.136,1.137 game_session.cxx,1.31,1.32 res_descriptor.cxx,1.12,1.13 res_descriptor.hxx,1.9,1.10 result.hxx,1.4,1.5,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/gui surface_button.cxx,1.5,1.6 surface_button.hxx,1.4,1.5
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.static,1.13,1.14
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/gui surface_button.cxx,1.5,1.6 surface_button.hxx,1.4,1.5
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.static,1.13,1.14
- Index(es):