[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src fonts.cxx,NONE,1.1 fonts.hxx,NONE,1.1
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src fonts.cxx,NONE,1.1 fonts.hxx,NONE,1.1 Makefile.am,1.94,1.95 display_graphic_context.cxx,1.2,1.3 display_graphic_context.hxx,1.1,1.2 graphic_context.hxx,1.1,1.2 pingu.cxx,1.23,1.24 pingu.hxx,1.14,1.15 pingus_main.cxx,1.12,1.13 |
Date: |
5 Sep 2002 11:26:37 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv28402
Modified Files:
Makefile.am display_graphic_context.cxx
display_graphic_context.hxx graphic_context.hxx pingu.cxx
pingu.hxx pingus_main.cxx
Added Files:
fonts.cxx fonts.hxx
Log Message:
- added gc stuff for fonts
added global fonthandles
-hotspots are still kind of broken
--- NEW FILE: fonts.cxx ---
// $Id: fonts.cxx,v 1.1 2002/09/05 11:26:35 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 "pingus_resource.hxx"
#include "fonts.hxx"
namespace Fonts
{
FontHandle pingus_small;
FontHandle pingus_large;
FontHandle smallfont;
FontHandle xterm;
FontHandle lcd;
void
init_fonts ()
{
pingus_small = PingusResource::load_font("Fonts/pingus_small", "fonts");
pingus_large = PingusResource::load_font("Fonts/pingus","fonts");
xterm = PingusResource::load_font("Fonts/xterm","fonts");
smallfont = PingusResource::load_font("Fonts/smallfont","fonts");
lcd = PingusResource::load_font("Fonts/numbers", "fonts");
}
}
/* EOF */
--- NEW FILE: fonts.hxx ---
// $Id: fonts.hxx,v 1.1 2002/09/05 11:26:35 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_FONTS_HXX
#define HEADER_PINGUS_FONTS_HXX
#include "graphic_context.hxx"
namespace Fonts
{
extern FontHandle pingus_small;
extern FontHandle pingus_large;
extern FontHandle smallfont;
extern FontHandle xterm;
extern FontHandle lcd;
/** Load all fonts */
void init_fonts ();
}
#endif
/* EOF */
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/Makefile.am,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- Makefile.am 4 Sep 2002 19:40:19 -0000 1.94
+++ Makefile.am 5 Sep 2002 11:26:34 -0000 1.95
@@ -140,6 +140,8 @@
exit_menu.hxx \
fade_out.cxx \
fade_out.hxx \
+fonts.hxx \
+fonts.cxx \
force_vector.cxx \
force_vector.hxx \
fps_counter.cxx \
Index: display_graphic_context.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/display_graphic_context.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- display_graphic_context.cxx 4 Sep 2002 21:02:40 -0000 1.2
+++ display_graphic_context.cxx 5 Sep 2002 11:26:35 -0000 1.3
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ClanLib/Display/Display/display.h>
+#include <ClanLib/Display/Font/font.h>
#include "math.hxx"
#include "sprite.hxx"
#include "display_graphic_context.hxx"
@@ -300,6 +301,30 @@
current = next;
next = next.rotate (pi/8, CL_Vector (0, 0, 1.0f));
}
+}
+
+void
+DisplayGraphicContext::print_left (FontHandle font, int x_pos, int y_pos,
const std::string& str)
+{
+ font->print_left(int(x_pos + get_x_offset () + center.x),
+ int(y_pos + get_y_offset () + center.y),
+ str.c_str ());
+}
+
+void
+DisplayGraphicContext::print_center (FontHandle font, int x_pos, int y_pos,
const std::string& str)
+{
+ font->print_center(int(x_pos + get_x_offset () + center.x),
+ int(y_pos + get_y_offset () + center.y),
+ str.c_str ());
+}
+
+void
+DisplayGraphicContext::print_right (FontHandle font, int x_pos, int y_pos,
const std::string& str)
+{
+ font->print_right(int(x_pos + get_x_offset () + center.x),
+ int(y_pos + get_y_offset () + center.y),
+ str.c_str ());
}
/* EOF */
Index: display_graphic_context.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/display_graphic_context.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- display_graphic_context.hxx 4 Sep 2002 17:49:48 -0000 1.1
+++ display_graphic_context.hxx 5 Sep 2002 11:26:35 -0000 1.2
@@ -106,6 +106,12 @@
void draw_circle (int x_pos, int y_pos, int radius,
float r, float g, float b, float a = 1.0f);
+ void print_left (FontHandle font, int x_pos, int y_pos, const std::string&
str);
+
+ void print_center (FontHandle font, int x_pos, int y_pos, const std::string&
str);
+
+ void print_right (FontHandle font, int x_pos, int y_pos, const std::string&
str);
+
private:
DisplayGraphicContext (const DisplayGraphicContext&);
DisplayGraphicContext operator= (const DisplayGraphicContext&);
Index: graphic_context.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/graphic_context.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- graphic_context.hxx 4 Sep 2002 17:49:48 -0000 1.1
+++ graphic_context.hxx 5 Sep 2002 11:26:35 -0000 1.2
@@ -20,11 +20,15 @@
#ifndef HEADER_PINGUS_GRAPHIC_CONTEXT_HXX
#define HEADER_PINGUS_GRAPHIC_CONTEXT_HXX
+#include <string>
#include <ClanLib/Core/Math/cl_vector.h>
#include <ClanLib/Core/Math/rect.h>
class Sprite;
class CL_Surface;
+class CL_Font;
+
+typedef CL_Font* FontHandle;
/** Abstract interface */
class GraphicContext
@@ -92,6 +96,16 @@
/** Draw a circle */
virtual void draw_circle (int x_pos, int y_pos, int radius,
float r, float g, float b, float a = 1.0f) =0;
+
+ // Font handling routines
+ /** Print a text left aligned */
+ virtual void print_left (FontHandle font, int x_pos, int y_pos, const
std::string& str) =0;
+
+ /** Print a text centred to the given position */
+ virtual void print_center (FontHandle font, int x_pos, int y_pos, const
std::string& str) =0;
+
+ /** Print a text right aligned */
+ virtual void print_right (FontHandle font, int x_pos, int y_pos, const
std::string& str) =0;
};
#endif
Index: pingu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- pingu.cxx 4 Sep 2002 22:10:47 -0000 1.23
+++ pingu.cxx 5 Sep 2002 11:26:35 -0000 1.24
@@ -33,6 +33,7 @@
#include "debug.hxx"
#include "string_converter.hxx"
#include "worldobj.hxx"
+#include "fonts.hxx"
using namespace Actions;
@@ -46,7 +47,6 @@
wall_action(0),
fall_action(0),
id(++id_counter),
- font(PingusResource::load_font("Fonts/numbers", "fonts")),
action_time(-1),
owner_id(owner),
status(PS_ALIVE),
@@ -353,9 +353,9 @@
// FIXME: in ticks, should probally be in seconds]
snprintf(str, 16, "%d", action_time);
- font->print_center(static_cast<int>(pos_x),
- static_cast<int>(pos_y - 45) + 2,
- str);
+ gc.print_center(Fonts::lcd,
+ static_cast<int>(pos_x), static_cast<int>(pos_y - 45) +
2,
+ str);
}
}
Index: pingu.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.hxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- pingu.hxx 4 Sep 2002 22:10:47 -0000 1.14
+++ pingu.hxx 5 Sep 2002 11:26:35 -0000 1.15
@@ -25,7 +25,6 @@
#include "pingu_enums.hxx"
// Forward declarations
-class CL_Font;
class CL_Vector;
class ActionHolder;
class PinguAction;
@@ -57,7 +56,6 @@
a demo file or in a network connection */
int id;
- CL_Font* font;
int action_time;
int owner_id;
Index: pingus_main.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_main.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pingus_main.cxx 17 Aug 2002 17:56:23 -0000 1.12
+++ pingus_main.cxx 5 Sep 2002 11:26:35 -0000 1.13
@@ -74,7 +74,7 @@
#include "screen_manager.hxx"
#include "sound_dummy.hxx"
#include "action_data.hxx"
-
+#include "fonts.hxx"
#include "sound_real.hxx"
void
@@ -621,6 +621,7 @@
<< std::endl;
}
+ Fonts::init_fonts ();
fps_counter.init();
console.init();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src fonts.cxx,NONE,1.1 fonts.hxx,NONE,1.1 Makefile.am,1.94,1.95 display_graphic_context.cxx,1.2,1.3 display_graphic_context.hxx,1.1,1.2 graphic_context.hxx,1.1,1.2 pingu.cxx,1.23,1.24 pingu.hxx,1.14,1.15 pingus_main.cxx,1.12,1.13,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/actions faller.cxx,1.19,1.20
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,1.1,1.2 bumper.hxx,1.1,1.2 fake_exit.cxx,1.1,1.2 fake_exit.hxx,1.1,1.2 hammer.cxx,1.1,1.2 hammer.hxx,1.1,1.2 info_box.cxx,1.7,1.8 laser_exit.cxx,1.1,1.2 laser_exit.hxx,1.1,1.2 smasher.cxx,1.1,1.2 smasher.hxx,1.1,1.2 spike.cxx,1.1,1.2 spike.hxx,1.1,1.2 switch_door.cxx,1.8,1.9 switch_door.hxx,1.7,1.8 teleporter.cxx,1.6,1.7 teleporter.hxx,1.8,1.9
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/actions faller.cxx,1.19,1.20
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,1.1,1.2 bumper.hxx,1.1,1.2 fake_exit.cxx,1.1,1.2 fake_exit.hxx,1.1,1.2 hammer.cxx,1.1,1.2 hammer.hxx,1.1,1.2 info_box.cxx,1.7,1.8 laser_exit.cxx,1.1,1.2 laser_exit.hxx,1.1,1.2 smasher.cxx,1.1,1.2 smasher.hxx,1.1,1.2 spike.cxx,1.1,1.2 spike.hxx,1.1,1.2 switch_door.cxx,1.8,1.9 switch_door.hxx,1.7,1.8 teleporter.cxx,1.6,1.7 teleporter.hxx,1.8,1.9
- Index(es):