[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2639 - in branches/pingus_sdl/src: . display gui sound
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r2639 - in branches/pingus_sdl/src: . display gui sound |
Date: |
Sat, 13 Jan 2007 22:09:09 +0100 |
Author: grumbel
Date: 2007-01-13 22:09:08 +0100 (Sat, 13 Jan 2007)
New Revision: 2639
Modified:
branches/pingus_sdl/src/SConscript
branches/pingus_sdl/src/display/drawing_context.cxx
branches/pingus_sdl/src/gui/display.cxx
branches/pingus_sdl/src/gui/screen_manager.cxx
branches/pingus_sdl/src/pingus_main.cxx
branches/pingus_sdl/src/pingus_menu_manager.cxx
branches/pingus_sdl/src/resource.cxx
branches/pingus_sdl/src/sound/sound.cxx
branches/pingus_sdl/src/sprite.cpp
Log:
- main menu now display, or at least parts of it
Modified: branches/pingus_sdl/src/SConscript
===================================================================
--- branches/pingus_sdl/src/SConscript 2007-01-13 20:43:01 UTC (rev 2638)
+++ branches/pingus_sdl/src/SConscript 2007-01-13 21:09:08 UTC (rev 2639)
@@ -43,6 +43,7 @@
# clanMikMod-0.8 ">=" 0.8.0')
env.ParseConfig('sdl-config --cflags --libs')
+env['LIBS'] += ['SDL_image']
# sdl_env.ParseConfig('sdl-config --cflags --libs')
# sdl_env['LIBS'] += ['SDL_image']
Modified: branches/pingus_sdl/src/display/drawing_context.cxx
===================================================================
--- branches/pingus_sdl/src/display/drawing_context.cxx 2007-01-13 20:43:01 UTC
(rev 2638)
+++ branches/pingus_sdl/src/display/drawing_context.cxx 2007-01-13 21:09:08 UTC
(rev 2639)
@@ -285,17 +285,21 @@
draw(new LineDrawingRequest(Vector(x1, y1), Vector(x2, y2), color, z));
}
+#endif
void
DrawingContext::draw_fillrect (float x1, float y1, float x2, float y2,
- const CL_Color& color, float z)
+ const Color& color, float z)
{
+#if 0
draw(new RectDrawingRequest(CL_Rectf(x1 + translate_stack.back().x, y1 +
translate_stack.back().y,
x2 + translate_stack.back().x, y2 +
translate_stack.back().y),
color,
true,
z));
+#endif
}
+#if 0
void
DrawingContext::draw_rect (float x1, float y1, float x2, float y2,
const CL_Color& color, float z)
Modified: branches/pingus_sdl/src/gui/display.cxx
===================================================================
--- branches/pingus_sdl/src/gui/display.cxx 2007-01-13 20:43:01 UTC (rev
2638)
+++ branches/pingus_sdl/src/gui/display.cxx 2007-01-13 21:09:08 UTC (rev
2639)
@@ -65,6 +65,7 @@
}
////CL_Display::flip();
+ SDL_Flip(screen);
}
void
Modified: branches/pingus_sdl/src/gui/screen_manager.cxx
===================================================================
--- branches/pingus_sdl/src/gui/screen_manager.cxx 2007-01-13 20:43:01 UTC
(rev 2638)
+++ branches/pingus_sdl/src/gui/screen_manager.cxx 2007-01-13 21:09:08 UTC
(rev 2639)
@@ -143,7 +143,7 @@
}
// Stupid hack to make this thing take less CPU
- ////CL_System::keep_alive(5);
+ SDL_Delay(10);
}
#if 0
Modified: branches/pingus_sdl/src/pingus_main.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_main.cxx 2007-01-13 20:43:01 UTC (rev
2638)
+++ branches/pingus_sdl/src/pingus_main.cxx 2007-01-13 21:09:08 UTC (rev
2639)
@@ -64,11 +64,11 @@
// #include "demo_session.hxx"
#include "debug.hxx"
//#include "fonts.hxx"
-// #include "pingus_menu_manager.hxx"
+#include "pingus_menu_manager.hxx"
// #include "resource.hxx"
// #include "pingu_action_factory.hxx"
// #include "credits.hxx"
-// #include "sound/sound.hxx"
+#include "sound/sound.hxx"
// #include "worldmap/manager.hxx"
#include "cheat.hxx"
// #include "blitter_test.hxx"
@@ -753,9 +753,9 @@
else // start a normal game
{
std::cout << "starting normal game" << std::endl;
- ///ScreenManager::instance()->push_screen(PingusMenuManager::instance
(), false);
+ ScreenManager::instance()->push_screen(PingusMenuManager::instance (),
false);
////ScreenManager::instance()->push_screen(new StoryScreen(), true);
- ScreenManager::instance()->push_screen(new DummyScreen(), true);
+ //ScreenManager::instance()->push_screen(new DummyScreen(), true);
std::cout << "done: starting normal game" << std::endl;
}
@@ -939,10 +939,10 @@
//// StatManager::init();
//// Resource::init();
-//// Fonts::init();
+ Fonts::init();
//// ScreenManager::init();
//// PingusMenuManager::init();
-//// Sound::PingusSound::init();
+ Sound::PingusSound::init();
//// PinguActionFactory::init();
//// Credits::init();
//// WorldMapNS::WorldMapManager::instance();
@@ -957,10 +957,10 @@
//// fps_counter.deinit();
console.deinit();
-//// Fonts::deinit();
+ Fonts::deinit();
//// Credits::deinit();
//// PinguActionFactory::deinit();
-//// Sound::PingusSound::deinit();
+ Sound::PingusSound::deinit();
//// PingusMenuManager::deinit();
//// WorldObjFactory::deinit();
//// WorldMapNS::WorldMapManager::deinit();
Modified: branches/pingus_sdl/src/pingus_menu_manager.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_menu_manager.cxx 2007-01-13 20:43:01 UTC
(rev 2638)
+++ branches/pingus_sdl/src/pingus_menu_manager.cxx 2007-01-13 21:09:08 UTC
(rev 2639)
@@ -69,8 +69,7 @@
bool
PingusMenuManager::draw (DrawingContext& gc)
{
-#if 0
- background.draw (gc);
+ background.draw(gc);
gc.draw_fillrect(0.0,
static_cast<float>(Display::get_height () - 22),
@@ -79,9 +78,8 @@
Color(0, 0, 0, 255));
for (MenuStackIter i = menu_stack.begin (); i != menu_stack.end (); ++i)
- (*i)->draw (gc);
+ (*i)->draw(gc);
-#endif
return true;
}
Modified: branches/pingus_sdl/src/resource.cxx
===================================================================
--- branches/pingus_sdl/src/resource.cxx 2007-01-13 20:43:01 UTC (rev
2638)
+++ branches/pingus_sdl/src/resource.cxx 2007-01-13 21:09:08 UTC (rev
2639)
@@ -118,7 +118,7 @@
Sprite
Resource::load_sprite(const std::string& res_name)
{
- return Sprite();
+ return Sprite(res_name);
#if 0
try {
Modified: branches/pingus_sdl/src/sound/sound.cxx
===================================================================
--- branches/pingus_sdl/src/sound/sound.cxx 2007-01-13 20:43:01 UTC (rev
2638)
+++ branches/pingus_sdl/src/sound/sound.cxx 2007-01-13 21:09:08 UTC (rev
2639)
@@ -32,35 +32,35 @@
void
PingusSound::init (PingusSoundImpl* s)
{
- PingusSound::init (new PingusSoundDummy());
-#if 0
if (s == 0)
- {
- if (sound_enabled || music_enabled)
{
- if (verbose)
- std::cout << "Init Sound" << std::endl;
+ PingusSound::init(new PingusSoundDummy());
+#if 0
+ if (sound_enabled || music_enabled)
+ {
+ if (verbose)
+ std::cout << "Init Sound" << std::endl;
- try {
- PingusSound::init (new PingusSoundReal ());
- } catch (CL_Error& err) {
- std::cout << "CL_Error: " << err.message << std::endl;
- std::cout << "Sound will be disabled" << std::endl;
- PingusSound::init (new PingusSoundDummy ());
- }
+ try {
+ PingusSound::init (new PingusSoundReal ());
+ } catch (CL_Error& err) {
+ std::cout << "CL_Error: " << err.message << std::endl;
+ std::cout << "Sound will be disabled" << std::endl;
+ PingusSound::init (new PingusSoundDummy ());
+ }
+ }
+ else
+ {
+ if (verbose)
+ std::cout << "Sound disabled" << std::endl;
+ PingusSound::init (new PingusSoundDummy ());
+ }
+#endif
}
- else
- {
- if (verbose)
- std::cout << "Sound disabled" << std::endl;
- PingusSound::init (new PingusSoundDummy ());
- }
- }
else
- {
- sound = s;
- }
-#endif
+ {
+ sound = s;
+ }
}
void
@@ -71,13 +71,13 @@
}
/** Load a sound file and play it immediately.
- @param filename The complete filename
- @param volume The desired volume level
- @param panning The desired panning level (stereo only) */
+ @param filename The complete filename
+ @param volume The desired volume level
+ @param panning The desired panning level (stereo only) */
void
PingusSound::play_sound(const std::string& name, float volume, float panning)
{
- assert (sound);
+ assert(sound);
sound->real_play_sound(name, volume, panning);
}
Modified: branches/pingus_sdl/src/sprite.cpp
===================================================================
--- branches/pingus_sdl/src/sprite.cpp 2007-01-13 20:43:01 UTC (rev 2638)
+++ branches/pingus_sdl/src/sprite.cpp 2007-01-13 21:09:08 UTC (rev 2639)
@@ -23,6 +23,9 @@
** 02111-1307, USA.
*/
+#include <iostream>
+#include <sstream>
+#include <assert.h>
#include "SDL.h"
#include "SDL_image.h"
#include "sprite.hpp"
@@ -30,9 +33,23 @@
class SpriteImpl
{
public:
+ SDL_Surface* surface;
+
SpriteImpl(const std::string& name)
{
- //IMG_Load
+ std::ostringstream str;
+ str << "data/images/" << name << ".png";
+ surface = IMG_Load(str.str().c_str());
+ if (!surface)
+ {
+ std::cout << "Error: Couldn't load " << str.str() << std::endl;
+ surface = IMG_Load("data/images/core/misc/404.png");
+ assert(surface);
+ }
+ else
+ {
+ std::cout << "Loaded sprite: " << name << std::endl;
+ }
}
};
@@ -53,6 +70,13 @@
void
Sprite::draw(float x, float y, SDL_Surface* target)
{
+ //std::cout << "Sprite: draw; " << x << ", " << y << std::endl;
+ SDL_Rect pos;
+ pos.x = (Sint16)x;
+ pos.y = (Sint16)y;
+ pos.w = 0;
+ pos.h = 0;
+ SDL_BlitSurface(impl->surface, NULL, target, &pos);
}
int
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2639 - in branches/pingus_sdl/src: . display gui sound,
grumbel at BerliOS <=