summaryrefslogtreecommitdiffhomepage
path: root/SixenseSDK/include/sixense_utils/controller_manager/controller_manager.hpp
blob: f6b674d8efc9ae7cccd718c2f6510ea6278f7c10 (plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 *
 * SIXENSE CONFIDENTIAL
 *
 * Copyright (C) 2011 Sixense Entertainment Inc.
 * All Rights Reserved
 *
 */

#ifndef CONTROLLER_MANAGER_HPP
#define CONTROLLER_MANAGER_HPP

#pragma warning(push)
#pragma warning( disable:4251 )

#include "sixense_utils/export.hpp"
#include "sixense_utils/interfaces.hpp"
#include "sixense_utils/sixense_utils_string.hpp"

#include <string>
#include <vector>
#include <map>

#include <sixense.h>

namespace sixenseUtils {

	class SIXENSE_UTILS_EXPORT ControllerManager : public IControllerManager {

	public:
		~ControllerManager();

		void setGameType( game_type gt );
		game_type getGameType();

		// Update the ControllerManager. Should be called each frame.
		void update( sixenseAllControllerData * );

		// Get the controller index for the given description, ie player 1's left hand is controller index 3
		int getIndex( controller_desc );

		// Force the user to rebind the controllers to the player slots.
		void rebind();

		// Register a callback that will get called when the mode changes
		void registerSetupCallback( setup_callback );

		// Returns true if the application should show the menu system
		bool isMenuVisible();

		// Returns the filename of the recommended texture for this step
		const char* getTextureFileName();

		// Returns a string describing this step
		const char* getStepString();


		ControllerManager::sound_type shouldPlaySound();

		static ControllerManager *getTheControllerManager();

		static controller_desc controllerDescFromString( sixense_utils_string str );

		setup_step getCurrentStep();

	protected:
		ControllerManager();

		game_type _game_type;

		// A pointer to the current step
		setup_step _current_step;

		// A list of maps, one map of steps for each of the game_types.
		std::vector< std::map< setup_step, class base_step*> >_steps;

		int _controller_map[LAST_CONTROLLER_DESC];

		setup_callback _callback;

	};

	// Singleton
	SIXENSE_UTILS_EXPORT ControllerManager *getTheControllerManager();

}

#pragma warning(pop)

#endif