File: RocketSystemInterface.h

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (72 lines) | stat: -rw-r--r-- 2,071 bytes parent folder | download | duplicates (3)
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
#pragma once

#include "globalincs/pstypes.h"

// Our Assert conflicts with the definitions inside libRocket
#pragma push_macro("Assert")
#undef Assert

#include <Rocket/Core/SystemInterface.h>

#pragma pop_macro("Assert")

namespace scpui {

/**
 * @brief Implementation of the rocket system interface for FSO
 */
class RocketSystemInterface : public Rocket::Core::SystemInterface {
  public:
	RocketSystemInterface();

	/**
	 * @details Uses the FSO timer routines for determining how much time has passed
	 *
	 * @return
	 */
	float GetElapsedTime() override;

	/**
	 * @details Translates the given string using the FSO translation mechanics. This will replace string of the form
	 * "XSTR("Test", 1234)" with the corresponding string that was defined in the tables. It will also replace variables
	 * such as $callsign
	 *
	 * @param translated
	 * @param input
	 * @return
	 */
	int TranslateString(Rocket::Core::String& translated, const Rocket::Core::String& input) override;

	/**
	 * @details Since the FSO file opening implementation already takes care of locating a specific file, this
	 * implementation simply returns the path that was specified in the document without altering it.
	 *
	 * @param translated_path
	 * @param document_path
	 * @param path
	 */
	void JoinPath(Rocket::Core::String& translated_path, const Rocket::Core::String& document_path,
	              const Rocket::Core::String& path) override;

	/**
	 * @details Logs a message using the FSO logging and message routines. Errors, Warnings, and Assertions will use the
	 * respective dialogs while logging and debug messages will be directed to the FSO log.
	 *
	 * @param type
	 * @param message
	 * @return
	 */
	bool LogMessage(Rocket::Core::Log::Type type, const Rocket::Core::String& message) override;

	/**
	 * @details Activates the keyboard by using the SDL provided functions for that.
	 */
	void ActivateKeyboard() override;

	/**
	 * @details Also uses the SDL functions for deactivating the keyboard again
	 */
	void DeactivateKeyboard() override;
};

} // namespace scpui