File: app.cpp

package info (click to toggle)
clanlib 1.0~svn3827-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 24,600 kB
  • sloc: cpp: 101,591; xml: 6,410; makefile: 1,743; ansic: 463; perl: 424; php: 247; sh: 53
file content (50 lines) | stat: -rw-r--r-- 997 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <ClanLib/display.h>
#include <ClanLib/sound.h>
#include <ClanLib/gl.h>

#include "app.h"
#include "world.h"

Application app;

int Application::main(int argc, char** argv)
{
	#ifdef _DEBUG
	// Create a console window for text-output if not available
	CL_ConsoleWindow console("ClanLib RTS Demo", 80, 1000); // 1000 allows a y-scrollbar to be present
	console.redirect_stdio();
	#endif
	
	try
	{
		// Init stuff
		CL_SetupCore setup_core;
		CL_SetupDisplay setup_display;
		CL_SetupSound setup_sound;
		CL_SetupGL setup_gl;
		
		// Create a window
		CL_DisplayWindow window("ClanLib RTS Demo", 1024, 768, false);

		CL_SoundOutput output(44100);

		// Create world
		World world;

		// Connect the Window close event
		CL_Slot slot_quit = window.sig_window_close().connect(&world, &World::on_quit);

		// Run the main loop
		world.run();
	}
	catch (CL_Error e)
	{
		std::cout << e.message.c_str() << std::endl;

		#ifdef _DEBUG
		console.display_close_message();
		#endif
	}

	return 0;
}