File: NS_Menu_Play.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 (66 lines) | stat: -rw-r--r-- 1,463 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
// NS_Menu_Play.cpp: implementation of the NS_Menu_Play class.
//
//////////////////////////////////////////////////////////////////////

#include "NS_Menu_Play.h"
#include <ClanLib/display.h>
#include <ClanLib/display.h>

#include <iostream>
#include "NS_MenuManager.h"

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

NS_Menu_Play::NS_Menu_Play(NS_MenuManager & menu_manager,
                           CL_StyleManager & style_manager,
                           std::string const & path_to_resource)
    :   NS_MenuGeneric(menu_manager, style_manager, path_to_resource),
    level_number(0),
    state(NS_Menu_Play::game_running)
{
    slots.connect(CL_Keyboard::sig_key_down(), this, &NS_Menu_Play::on_key_down);
}

NS_Menu_Play::~NS_Menu_Play()
{

}

void NS_Menu_Play::on_key_down(CL_InputEvent const & key)
{
    if (!is_input_enabled())
        return;

    if (key.id == CL_KEY_ESCAPE)
    {
        // Do cleanup
        on_switch_to_main_menu();
    }
}

void NS_Menu_Play::run_task()
{
	NS_MenuGeneric::run_task();
}

void NS_Menu_Play::on_timer()
{
    on_switch_to_main_menu();
}

void NS_Menu_Play::on_quit()
{
    NS_MenuGeneric::quit();
}

void NS_Menu_Play::on_switch_to_main_menu()
{
    switch_to("menu_main");
}

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