[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] rev 2311 - in trunk: data/data src/editor src/gui src/world
From: |
Ingo Ruhnke |
Subject: |
[Pingus-CVS] rev 2311 - in trunk: data/data src/editor src/gui src/worldmap src/worldobjs |
Date: |
Fri, 07 May 2004 13:21:46 +0200 |
Author: grumbel
Date: 2004-05-07 13:21:46 +0200 (Fri, 07 May 2004)
New Revision: 2311
Modified:
trunk/data/data/core.xml
trunk/src/editor/editor_view.cxx
trunk/src/gui/buffer_graphic_context.cxx
trunk/src/gui/display_graphic_context.cxx
trunk/src/worldmap/level_dot.cxx
trunk/src/worldmap/level_dot.hxx
trunk/src/worldmap/pingus.cxx
trunk/src/worldmap/pingus.hxx
trunk/src/worldobjs/info_box.cxx
trunk/src/worldobjs/surface_background.cxx
trunk/src/worldobjs/switch_door.cxx
Log:
- fixed worldmap a bit
Modified: trunk/data/data/core.xml
===================================================================
--- trunk/data/data/core.xml 2004-05-06 22:24:21 UTC (rev 2310)
+++ trunk/data/data/core.xml 2004-05-07 11:21:46 UTC (rev 2311)
@@ -184,10 +184,13 @@
<section name="worldmap">
<sprite name="pingus">
+ <translation origin="bottom_center" x="0" y="2" />
<image file="../images/core/worldmap/pingus.png">
<grid
- array="8,2"
- height="24" name="pingus" width="24" x="0" y="0" />
+ pos="0,0"
+ size="24,24"
+ array="8,2"
+ />
</image>
</sprite>
@@ -195,31 +198,41 @@
<image file="../images/core/worldmap/tube.png" />
</sprite>
<sprite name="dot_invalid">
+ <translation origin="center" />
<image file="../images/core/worldmap/dot_invalid.png" />
</sprite>
<sprite name="dot_green">
+ <translation origin="center" />
<image file="../images/core/worldmap/dot_green.png" />
</sprite>
<sprite name="dot_red">
+ <translation origin="center" />
<image file="../images/core/worldmap/dot_red.png" />
</sprite>
<sprite name="dot_green_hl">
+ <translation origin="center" />
<image file="../images/core/worldmap/dot_green_hl.png" />
</sprite>
<sprite name="dot_red_hl">
+ <translation origin="center" />
<image file="../images/core/worldmap/dot_red_hl.png" />
</sprite>
<sprite name="dot_border">
+ <translation origin="center" />
<image file="../images/core/worldmap/dot_border.png" />
</sprite>
<sprite name="flaggreen">
+ <translation origin="center" />
<image file="../images/core/worldmap/flaggreen.png" />
</sprite>
<sprite name="arrow">
+ <translation origin="bottom_center" />
<image file="../images/core/worldmap/arrow.png" />
</sprite>
<sprite name="pingus_standing">
- <image file="../images/core/worldmap/pingus_standing.png" />
+ <translation origin="bottom_center" />
+ <image file="../images/core/worldmap/pingus_standing.png">
+ </image>
</sprite>
<sprite name="levelname_bg">
<image file="../images/core/worldmap/levelname_bg.png" />
Modified: trunk/src/editor/editor_view.cxx
===================================================================
--- trunk/src/editor/editor_view.cxx 2004-05-06 22:24:21 UTC (rev 2310)
+++ trunk/src/editor/editor_view.cxx 2004-05-07 11:21:46 UTC (rev 2311)
@@ -166,22 +166,21 @@
void
EditorView::draw (CL_Sprite& sur, const Vector& pos, int frame)
{
+ sur.draw(int(pos.x + get_x_offset () + center.x),
+ int(pos.y + get_y_offset () + center.y));
}
void
EditorView::draw (CL_Sprite& sur, const Vector& pos)
{
+ sur.draw(int(pos.x + get_x_offset () + center.x),
+ int(pos.y + get_y_offset () + center.y));
}
void
EditorView::draw (Sprite& sprite, const Vector& pos)
{
-#ifdef CLANLIB_0_6
- CL_Surface sur(sprite.get_surface ());
- draw(sur,
- (int) pos.x + sprite.get_x_align (),
- (int) pos.y + sprite.get_y_align ());
-#endif
+ draw(sprite.get_sprite(), pos);
}
void
Modified: trunk/src/gui/buffer_graphic_context.cxx
===================================================================
--- trunk/src/gui/buffer_graphic_context.cxx 2004-05-06 22:24:21 UTC (rev
2310)
+++ trunk/src/gui/buffer_graphic_context.cxx 2004-05-07 11:21:46 UTC (rev
2311)
@@ -69,15 +69,13 @@
void
BufferGraphicContext::draw (CL_Surface& sur, int x_pos, int y_pos, int frame)
{
-#ifdef CLANLIB_0_6
//std::cout << "BufferGraphicContext: " << x_pos << ", " << y_pos << "
frame: " << frame << std::endl;
try {
- Blitter::put_surface(canvas, sur.get_provider(), x_pos, y_pos);
+ Blitter::put_surface(canvas, sur.get_pixeldata(), x_pos, y_pos);
} catch (PingusError& err) {
std::cout << "BufferGraphicContext: " << err.get_message() << std::endl;
}
UNUSED_ARG(frame);
-#endif
}
void
Modified: trunk/src/gui/display_graphic_context.cxx
===================================================================
--- trunk/src/gui/display_graphic_context.cxx 2004-05-06 22:24:21 UTC (rev
2310)
+++ trunk/src/gui/display_graphic_context.cxx 2004-05-07 11:21:46 UTC (rev
2311)
@@ -175,9 +175,9 @@
}
else
{
-#ifdef CLANLIB_0_6
- sur.draw(w2s_x(x_pos), w2s_y(y_pos),
- offset.z, offset.z);
+ sur.draw(w2s_x(x_pos), w2s_y(y_pos));
+#ifdef CLANLIB_0_6 // scale issue
+ offset.z, offset.z);
#endif
}
}
@@ -185,18 +185,18 @@
void
DisplayGraphicContext::draw (CL_Surface& sur, int x_pos, int y_pos, int frame)
{
-#ifdef CLANLIB_0_6
+ // FIXME: CLANLIB_0_6, no frames in CL_Surface
if (offset.z == 1.0)
{
- sur.draw(w2s_x(x_pos), w2s_y(y_pos), frame);
+ sur.draw(w2s_x(x_pos), w2s_y(y_pos));
}
else
{
- sur.draw(w2s_x(x_pos), w2s_y(y_pos),
- offset.z, offset.z,
- frame);
+ sur.draw(w2s_x(x_pos), w2s_y(y_pos));
+#ifdef CLANLIB_0_6 // no scale in cl_surface
+ offset.z, offset.z);
+#endif
}
-#endif
}
void
Modified: trunk/src/worldmap/level_dot.cxx
===================================================================
--- trunk/src/worldmap/level_dot.cxx 2004-05-06 22:24:21 UTC (rev 2310)
+++ trunk/src/worldmap/level_dot.cxx 2004-05-07 11:21:46 UTC (rev 2311)
@@ -42,19 +42,13 @@
LevelDot::LevelDot(xmlDocPtr doc, xmlNodePtr cur)
: Dot(doc, XMLhelper::skip_blank(cur->children)),
- green_dot_sur("worldmap/dot_green", "core"),
- red_dot_sur("worldmap/dot_red", "core"),
- unaccessible_dot_sur("worldmap/dot_invalid", "core"),
- highlight_green_dot_sur("worldmap/dot_green_hl", "core"),
- highlight_red_dot_sur("worldmap/dot_red_hl", "core"),
+ green_dot_sur(PingusResource::load_sprite("worldmap/dot_green", "core")),
+ red_dot_sur(PingusResource::load_sprite("worldmap/dot_red", "core")),
+ unaccessible_dot_sur(PingusResource::load_sprite("worldmap/dot_invalid",
"core")),
+
highlight_green_dot_sur(PingusResource::load_sprite("worldmap/dot_green_hl",
"core")),
+ highlight_red_dot_sur(PingusResource::load_sprite("worldmap/dot_red_hl",
"core")),
plf(0)
{
- green_dot_sur.set_align_center();
- red_dot_sur.set_align_center();
- highlight_green_dot_sur.set_align_center();
- highlight_red_dot_sur.set_align_center();
- unaccessible_dot_sur.set_align_center();
-
cur = cur->children;
// Skip dot entry
cur = cur->next;
@@ -152,12 +146,11 @@
void
LevelDot::draw_hover(GraphicContext& gc)
{
-#ifdef CLANLIB_0_6
int pos_correction = 0;
if (accessible())
{
- int length =
Fonts::pingus_small.get_text_width(System::translate(get_plf()->get_levelname()))
/ 2;
+ int length = Fonts::pingus_small.bounding_rect(0, 0,
System::translate(get_plf()->get_levelname())).get_width() / 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;
@@ -171,7 +164,7 @@
}
else
{
- int length = Fonts::pingus_small.get_text_width(_("locked")) / 2;
+ int length = Fonts::pingus_small.bounding_rect(0, 0,
_("locked")).get_width() / 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;
@@ -190,7 +183,6 @@
int(pos.x), int(pos.y - 56),
get_plf()->get_resname());
}
-#endif
}
void
Modified: trunk/src/worldmap/level_dot.hxx
===================================================================
--- trunk/src/worldmap/level_dot.hxx 2004-05-06 22:24:21 UTC (rev 2310)
+++ trunk/src/worldmap/level_dot.hxx 2004-05-07 11:21:46 UTC (rev 2311)
@@ -31,11 +31,11 @@
class LevelDot : public Dot
{
private:
- Sprite green_dot_sur;
- Sprite red_dot_sur;
- Sprite unaccessible_dot_sur;
- Sprite highlight_green_dot_sur;
- Sprite highlight_red_dot_sur;
+ CL_Sprite green_dot_sur;
+ CL_Sprite red_dot_sur;
+ CL_Sprite unaccessible_dot_sur;
+ CL_Sprite highlight_green_dot_sur;
+ CL_Sprite highlight_red_dot_sur;
std::string levelname;
PLFHandle plf;
Modified: trunk/src/worldmap/pingus.cxx
===================================================================
--- trunk/src/worldmap/pingus.cxx 2004-05-06 22:24:21 UTC (rev 2310)
+++ trunk/src/worldmap/pingus.cxx 2004-05-07 11:21:46 UTC (rev 2311)
@@ -22,6 +22,7 @@
#include "../gui/graphic_context.hxx"
#include "dot.hxx"
#include "../math.hxx"
+#include "../pingus_resource.hxx"
#include "pingus.hxx"
namespace Pingus {
@@ -30,21 +31,15 @@
Pingus::Pingus (PathGraph* arg_path)
: Drawable("pingus"),
path(arg_path),
- sprite ("worldmap/pingus", "core", 27.0f, Sprite::RIGHT),
- sprite_standing ("worldmap/pingus_standing", "core"),
- arrow ("worldmap/arrow", "core")
+ sprite (PingusResource::load_sprite("worldmap/pingus", "core")),
+ sprite_standing (PingusResource::load_sprite("worldmap/pingus_standing",
"core")),
+ arrow (PingusResource::load_sprite("worldmap/arrow", "core"))
{
final_target_node = NoNode;
current_node = NoNode;
- arrow.set_align_center_bottom();
-
pos.x = 320;
pos.y = 200;
-
- sprite.set_align (-sprite.get_width()/2, 2 - sprite.get_height());
- sprite_standing.set_align (-sprite_standing.get_width()/2,
- -sprite_standing.get_height());
}
Pingus::~Pingus ()
@@ -60,12 +55,15 @@
gc.draw(arrow, path->get_dot(final_target_node)->get_pos());
}
+#ifdef CLANLIB_0_6
// FIXME: Replace the sprite and add up/down here
float direction = get_direction();
+
if (direction >= 0 && direction < 180)
sprite.set_direction(Sprite::RIGHT);
else
sprite.set_direction(Sprite::LEFT);
+#endif
if (!is_walking())
gc.draw(sprite_standing, pos);
Modified: trunk/src/worldmap/pingus.hxx
===================================================================
--- trunk/src/worldmap/pingus.hxx 2004-05-06 22:24:21 UTC (rev 2310)
+++ trunk/src/worldmap/pingus.hxx 2004-05-07 11:21:46 UTC (rev 2311)
@@ -34,9 +34,9 @@
{
private:
PathGraph* path;
- Sprite sprite;
- Sprite sprite_standing;
- Sprite arrow;
+ CL_Sprite sprite;
+ CL_Sprite sprite_standing;
+ CL_Sprite arrow;
/** The node on which the pingu currently stands, NoNode if the pingu is
currently on the move to another node */
Modified: trunk/src/worldobjs/info_box.cxx
===================================================================
--- trunk/src/worldobjs/info_box.cxx 2004-05-06 22:24:21 UTC (rev 2310)
+++ trunk/src/worldobjs/info_box.cxx 2004-05-07 11:21:46 UTC (rev 2311)
@@ -46,7 +46,6 @@
void
InfoBox::draw (GraphicContext& gc)
{
-#ifdef CLANLIB_0_6
int x = static_cast<int>(gc.get_x_offset() + (gc.get_width ()/2));
int y = static_cast<int>(gc.get_y_offset() + (gc.get_height()/2));
@@ -55,22 +54,21 @@
if (is_open)
{
- int width = Fonts::pingus_small.get_text_width(data->info_text.c_str());
+ int width = Fonts::pingus_small.bounding_rect(0, 0,
data->info_text).get_width();
int border = 6;
gc.draw_line(data->pos, data->pos + Vector(0, 0 - 100), 0.0f, 1.0f,
0.0f, 1.0f);
gc.draw(data->sprite, data->pos);
- CL_Display::fill_rect(x_pos - width/2 - border,
- y_pos - border,
- x_pos + width/2 + border,
- y_pos + Fonts::pingus_small->get_height() + border,
- 0.0, 0.0, 0.0, 1.0);
- gc.print_center(Fonts::pingus_small, x_pos, y_pos,
data->info_text.c_str());
+ CL_Display::fill_rect(CL_Rect(x_pos - width/2 - border,
+ y_pos - border,
+ x_pos + width/2 + border,
+ y_pos + Fonts::pingus_small.get_height() +
border),
+ CL_Color(0, 0, 0, 255));
+ gc.print_center(Fonts::pingus_small, x_pos, y_pos, data->info_text);
}
else
{
gc.draw(data->sprite, data->pos);
}
-#endif
}
void
Modified: trunk/src/worldobjs/surface_background.cxx
===================================================================
--- trunk/src/worldobjs/surface_background.cxx 2004-05-06 22:24:21 UTC (rev
2310)
+++ trunk/src/worldobjs/surface_background.cxx 2004-05-07 11:21:46 UTC (rev
2311)
@@ -45,7 +45,6 @@
CL_Surface source_surface = PingusResource::load_surface(data->desc);
-#ifdef CLANLIB_0_6
CL_PixelBuffer canvas;
// Scaling Code
@@ -92,6 +91,7 @@
FIXME: the bug might be in create_canvas() and not in fill_rect()
*/
+#ifdef CLANLIB_0_6
if (data->color.alpha != 0.0 && data->color != Color(0, 0, 0, 1.0f))
{ // Workaround for a bug which caused all levels to have the
// wrong background color
@@ -100,11 +100,8 @@
data->color.red, data->color.green, data->color.blue,
data->color.alpha);
}
- bg_surface = CL_Surface(&canvas, false);
-#endif
- bg_surface = source_surface;
+ bg_surface = CL_Surface(new CL_PixelBuffer(canvas), true);
-#ifdef CLANLIB_0_6
//bg_surface = CAImageManipulation::changeHSV(bg_surface, 150, 100, 0);
counter.set_size(bg_surface.get_frame_count());
counter.set_speed(1.0);
Modified: trunk/src/worldobjs/switch_door.cxx
===================================================================
--- trunk/src/worldobjs/switch_door.cxx 2004-05-06 22:24:21 UTC (rev 2310)
+++ trunk/src/worldobjs/switch_door.cxx 2004-05-07 11:21:46 UTC (rev 2311)
@@ -17,6 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <ClanLib/Display/pixel_buffer.h>
#include "../col_map.hxx"
#include "../gui/graphic_context.hxx"
#include "../pingu.hxx"
@@ -106,8 +107,7 @@
// it, we remove the door from the colmap
if (current_door_height + 10 < data->door_height)
{
-#ifdef CLANLIB_0_6
- world->get_colmap()->put(door_box,
+
world->get_colmap()->put(door_box.get_frame_surface(0).get_pixeldata(),
static_cast<int>(data->door_pos.x),
static_cast<int>(data->door_pos.y),
Groundtype::GP_NOTHING);
@@ -117,7 +117,6 @@
static_cast<int>(data->door_pos.y) + i
* door_tile.get_height()
+
door_box.get_height(),
Groundtype::GP_NOTHING);
-#endif
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] rev 2311 - in trunk: data/data src/editor src/gui src/worldmap src/worldobjs,
Ingo Ruhnke <=