1
// $Id: Story.cc,v 1.12 2001/07/27 19:35:36 grumbel Exp $
3
// Pingus - A free Lemmings clone
4
// Copyright (C) 2000 Ingo Ruhnke <grumbel@gmx.de>
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 2
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
#include "worldmap/PingusWorldMapManager.hh"
25
#include "DeltaManager.hh"
26
#include "LayerManager.hh"
27
#include "PingusResource.hh"
28
#include "PingusMenuManager.hh"
31
Story::Story(PingusMenuManager* manager)
32
: PingusSubMenu (manager)
45
small_font = PingusResource::load_font("Fonts/pingus_small", "fonts");
46
large_font = PingusResource::load_font("Fonts/pingus", "fonts");
47
background = PingusResource::load_surface("Textures/stones", "textures");
48
story = PingusResource::load_surface("Story/story1", "story");
54
Story::update (float delta)
61
CL_Display::fill_rect (0,0,
62
CL_Display::get_width (),
63
CL_Display::get_height (),
66
story.put_screen(CL_Display::get_width()/2 - (story.get_width()/2),
68
CL_Display::fill_rect(CL_Display::get_width()/2 - (story.get_width()/2) + 25,
69
50 + story.get_height() + 25,
70
CL_Display::get_width()/2 + (story.get_width()/2) - 25,
71
CL_Display::get_height() - 25,
74
small_font->print_left(125, 80 + story.get_height() + 25 + (1 * small_font->get_height()), "Insert extremly interesting story here...");
75
small_font->print_left(125, 80 + story.get_height() + 25 + (2 * small_font->get_height()), "...");
76
small_font->print_left(125, 80 + story.get_height() + 25 + (3 * small_font->get_height()), "...");
77
small_font->print_left(125, 80 + story.get_height() + 25 + (4 * small_font->get_height()), "...");
78
small_font->print_left(125, 80 + story.get_height() + 25 + (5 * small_font->get_height()), "...");
79
small_font->print_left(125, 80 + story.get_height() + 25 + (6 * small_font->get_height()), "...");
83
Story::display_string(std::string current_line)
85
/* while ((pos = str.find("\n")) != string::npos)
87
tmp_string = str.substr(0, pos);
88
small_font->print_left(current_line + tmp_string);
91
str = str.substr(pos+1);
95
std::string tmp_string;
96
std::vector<std::string> output_buffer;
98
// FIXME: This could be optimized if xterm would be a fixed font...
99
while(small_font->get_text_width(current_line.c_str()) > (CL_Display::get_width() - 100))
102
for (pos = current_line.size();
103
small_font->get_text_width(current_line.substr(0, pos).c_str())
104
> (CL_Display::get_width() - 100);
107
tmp_string = current_line.substr(0, pos);
109
output_buffer.push_back(tmp_string);
110
current_line = current_line.substr(pos);
116
for(std::vector<std::string>::iterator i = output_buffer.begin();
117
i != output_buffer.end();
120
small_font->print_left(x_pos, y_pos + j*small_font->get_height(),
126
Story::on_button_press (CL_InputDevice* device,const CL_Key& key)
128
manager->disable_events ();
129
// FIXME: This looks ugly...
130
PingusWorldMapManager worldmap_manager;
131
worldmap_manager.display();
132
manager->enable_events ();
133
manager->set_menu (&manager->mainmenu);