File: NS_Menu_Main.cpp

package info (click to toggle)
clanlib 1.0~svn3827-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 24,632 kB
  • ctags: 16,580
  • sloc: cpp: 101,591; xml: 6,410; makefile: 1,743; ansic: 463; perl: 424; php: 247; sh: 53
file content (73 lines) | stat: -rw-r--r-- 2,146 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// NS_Menu_Main.cpp: implementation of the NS_Menu_Main class.
//
//////////////////////////////////////////////////////////////////////

#include <iostream>
#include "NS_Menu_Main.h"
#include "NS_Profile.h"
//#include "../Game/NS_Players.h"

#include <ClanLib/display.h>
//#include <ClanLib/core.h>

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

NS_Menu_Main::NS_Menu_Main(NS_MenuManager & menu_manager,
                           CL_StyleManager & style_manager,
                           std::string const & path_to_resource)
    : NS_MenuGeneric(menu_manager, style_manager, path_to_resource),
	back_ground(new CL_Sprite("menu_right_bottom", style_manager.get_resources()))
{
	CL_Button * btn_to_profile = dynamic_cast<CL_Button*>(comp_manager->get_component(("btn_to_profile")));
	if (btn_to_profile)
		slots.connect(btn_to_profile->sig_clicked(), this, &NS_Menu_Main::on_profile);

	CL_Button * btn_to_game = dynamic_cast<CL_Button*>(comp_manager->get_component(("btn_to_game")));
	if (btn_to_game)
		slots.connect(btn_to_game->sig_clicked(), this, &NS_Menu_Main::on_switch_to_game_menu);

	CL_Button * btn_to_credits = dynamic_cast<CL_Button*>(comp_manager->get_component(("btn_to_credits")));
	if (btn_to_credits)
		slots.connect(btn_to_credits->sig_clicked(), this, &NS_Menu_Main::on_switch_to_credits_menu);

	CL_Button * btn_quit = dynamic_cast<CL_Button*>(comp_manager->get_component(("btn_quit")));
	if (btn_quit)
		slots.connect(btn_quit->sig_clicked(), this, &NS_Menu_Main::on_quit);
}

NS_Menu_Main::~NS_Menu_Main()
{
	delete back_ground;
}

void NS_Menu_Main::on_profile()
{
    NS_Profile::open(this);
}

void NS_Menu_Main::on_quit()
{
    NS_MenuGeneric::on_exit();
}

void NS_Menu_Main::on_switch_to_credits_menu()
{
    switch_to("menu_credits");
}

void NS_Menu_Main::on_switch_to_game_menu()
{
	switch_to("menu_game");
}

void NS_Menu_Main::switch_to(std::string const & menu_name)
{
    NS_MenuGeneric::switch_to(menu_name);
}

void NS_Menu_Main::on_begin_paint()
{
    back_ground->draw(0,0);
}