Skip to content

Commit f8074e8

Browse files
author
phillemann
committed
First version of states::ingame and the machine
You can start the program via build/insula. It'll show the terrain and it allows camera movement. That'll basically be the freelook mode later.
1 parent b8c1569 commit f8074e8

23 files changed

+83
-6
lines changed

graphics/shader.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@ insula::graphics::shader::program()
7171
{
7272
return program_;
7373
}
74+
75+
insula::graphics::shader::~shader() {}

graphics/shader.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class shader
6565

6666
sge::renderer::glsl::program_ptr const
6767
program();
68+
69+
~shader();
6870
private:
6971
typedef
7072
fcppt::container::map

graphics/stats.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,5 @@ insula::graphics::stats::update_and_render(
5252
sge::font::align_v::top,
5353
sge::font::flags::none);
5454
}
55+
56+
insula::graphics::stats::~stats() {}

graphics/stats.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class stats
3131
void
3232
update_and_render(
3333
fcppt::string const &additional_stats = FCPPT_TEXT(""));
34+
35+
~stats();
3436
private:
3537
sge::time::frames_counter counter_;
3638
sge::renderer::device_ptr const renderer_;

height_map/object.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ insula::height_map::object::height_scaling() const
311311
height_scaling_;
312312
}
313313

314+
insula::height_map::object::~object() {}
315+
314316
void
315317
insula::height_map::object::regenerate(
316318
graphics::scalar const &cell_size,

height_map/object.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class object
6767

6868
graphics::scalar
6969
height_scaling() const;
70+
71+
~object();
7072
private:
7173
graphics::camera::object const &camera_;
7274
sge::renderer::device_ptr const renderer_;

insula.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "create_variables_map.hpp"
22
#include "machine.hpp"
3+
#include "states/ingame.hpp"
34
#include "help_needed.hpp"
45
#include <sge/time/timer.hpp>
56
#include <sge/time/second.hpp>
@@ -16,6 +17,8 @@ try
1617
argc,
1718
argv));
1819

20+
m.initiate();
21+
1922
sge::time::timer frame_timer(
2023
sge::time::second(1));
2124
while (m.running())

machine.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,5 @@ insula::machine::running() const
248248
{
249249
return running_;
250250
}
251+
252+
insula::machine::~machine() {}

machine.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class machine
5858
// it's false)
5959
bool
6060
running() const;
61+
62+
~machine();
6163
private:
6264
bool running_;
6365
sge::parse::json::object config_file_;

media/config.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"music" :
3+
{
4+
"events" :
5+
{
6+
},
7+
"random" :
8+
[
9+
],
10+
"crossfade_seconds" : 5
11+
},
12+
"sounds" :
13+
{
14+
"events" :
15+
{
16+
}
17+
}
18+
}

model/object.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,5 @@ insula::model::object::bounding_box() const
271271
{
272272
return bounding_box_;
273273
}
274+
275+
insula::model::object::~object() {}

model/object.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class object
4444

4545
sge::model::object_ptr const
4646
raw();
47+
48+
~object();
4749
private:
4850
sge::model::object_ptr const raw_;
4951
graphics::camera::object const &camera_;

music_controller.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ insula::music_controller::stop()
144144
silence_source_);
145145
}
146146

147+
insula::music_controller::~music_controller() {}
148+
147149
void
148150
insula::music_controller::do_play(
149151
sge::audio::sound::base_ptr b)

music_controller.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ class music_controller
4040
play_random();
4141

4242
void
43-
4443
stop();
44+
45+
~music_controller();
4546
private:
4647
typedef
4748
std::map

notizen.org

+3-2
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ Sollte eine Klasse sein, die ein Model reinbekommt, sowie einen Parameter, der a
608608
** TODO Sounds [0/1]
609609
*** TODO Looping von Musik fixen
610610
Man kann bei Streamingsounds loop einstellen, das funzt aber nicht richtig
611-
** TODO Diverses [20/26]
611+
** TODO Diverses [21/27]
612612
*** DONE Framecounter einbauen
613613
CLOSED: [2010-07-30 Fri 18:24]
614614
*** DONE gizmo_init fixen
@@ -710,7 +710,8 @@ wurde.
710710
Wieso ist die Farbe ganz unten nicht korrekt, wenn man einen weniger
711711
detailreichen Skydome erzeugt?
712712
*** TODO Textur tst spiegelverkehrt
713-
*** TODO sge::model Flag einbauen, ob y und z gedreht werden sollen
713+
*** DONE sge::model Flag einbauen, ob y und z gedreht werden sollen
714+
CLOSED: [2010-08-21 Sat 17:06]
714715
*** TODO physics von model abkoppeln
715716

716717
Erstelle eine Funktion, die eine shape aus einem sge::model::object,

physics/debug_drawer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,5 @@ insula::physics::debug_drawer::render()
270270
vb_->size()),
271271
sge::renderer::nonindexed_primitive_type::line);
272272
}
273+
274+
insula::physics::debug_drawer::~debug_drawer() {}

physics/debug_drawer.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ class debug_drawer
9292

9393
void
9494
render();
95+
96+
~debug_drawer();
9597
private:
9698
typedef
9799
std::vector

skydome/object.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,5 @@ insula::skydome::object::gradient() const
404404
{
405405
return gradient_;
406406
}
407+
408+
insula::skydome::object::~object() {}

skydome/object.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class object
4646

4747
insula::skydome::gradient const
4848
gradient() const;
49+
50+
~object();
4951
private:
5052
graphics::camera::object const &camera_;
5153
sge::renderer::device_ptr const renderer_;

sound_controller.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,5 @@ insula::sound_controller::update()
8888
{
8989
pool_.update();
9090
}
91+
92+
insula::sound_controller::~sound_controller() {}

sound_controller.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class sound_controller
5858
// deleted properly
5959
void
6060
update();
61+
62+
~sound_controller();
6163
private:
6264
typedef
6365
std::map

states/ingame.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
#include "../physics/vec3.hpp"
1212
#include "../graphics/box.hpp"
1313
#include "../console/object.hpp"
14+
#include "../events/tick.hpp"
15+
#include "../events/render.hpp"
1416
#include <sge/console/object.hpp>
1517
#include <fcppt/math/box/structure_cast.hpp>
1618
#include <fcppt/text.hpp>
19+
#include <fcppt/io/cout.hpp>
1720

1821
insula::states::ingame::ingame(
1922
my_context ctx)
@@ -104,7 +107,7 @@ insula::states::ingame::react(
104107
sge::renderer::state::cull_mode::back);
105108
water_->render();
106109

107-
if (toggle_physics_debug_)
110+
if (physics_debug_)
108111
{
109112
physics_debug_drawer_.setDebugMode(
110113
btIDebugDraw::DBG_DrawWireframe);
@@ -113,3 +116,5 @@ insula::states::ingame::react(
113116

114117
return discard_event();
115118
}
119+
120+
insula::states::ingame::~ingame() {}

states/ingame.hpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
#include "../physics/debug_drawer.hpp"
1313
#include "../water/object_ptr.hpp"
1414
#include "../water/console_proxy.hpp"
15-
#include "../events/tick_fwd.hpp"
16-
#include "../events/render_fwd.hpp"
15+
// Why do these have to be completely defined? I thought forward
16+
// declaring them was enough o_O
17+
#include "../events/tick.hpp"
18+
#include "../events/render.hpp"
1719
#include <boost/statechart/state.hpp>
1820
#include <boost/statechart/result.hpp>
21+
#include <boost/statechart/custom_reaction.hpp>
22+
#include <boost/mpl/list/list10.hpp>
1923

2024
namespace insula
2125
{
@@ -30,6 +34,14 @@ class ingame
3034
public boost::statechart::state<ingame,machine>
3135
{
3236
public:
37+
typedef
38+
boost::mpl::list2
39+
<
40+
boost::statechart::custom_reaction<events::tick>,
41+
boost::statechart::custom_reaction<events::render>
42+
>
43+
reactions;
44+
3345
explicit
3446
ingame(
3547
my_context);
@@ -43,6 +55,9 @@ class ingame
4355
boost::statechart::result
4456
react(
4557
events::render const &);
58+
59+
// We've got pointers to forward-declared objects here
60+
~ingame();
4661
private:
4762
// The heightmap has to be initialized first because it's needed for
4863
// the physics world

0 commit comments

Comments
 (0)