-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSystem.cpp
More file actions
98 lines (76 loc) · 2.34 KB
/
System.cpp
File metadata and controls
98 lines (76 loc) · 2.34 KB
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
92
93
94
95
96
97
98
/*
* System.cpp
*
* Copyright 2015 Joaquín Monteagudo Gómez <kindos7@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
/*
* FDX_Fighter - System.cpp
* Little spaceship game made with C++ and SFML
* System resources - code file
*/
/*
Version 0.1 (dd/mm/yy, 8/4/2015 -> )
*/
/*
Preprocessor
*/
/* Includes */
//Headers file
#include "System.hpp"
/* Defines */
/*Constants*/
/*Macros*/
//Namespace
namespace fdx { namespace fighter
{
/*
Code
*/
/* Init */
/*KM_Controller*/
const Event_KM KM_Controller::DEF_ACC(Event_KM::CTRL_KB,sf::Keyboard::A);
const Event_KM KM_Controller::DEF_BRAKE(Event_KM::CTRL_KB,sf::Keyboard::D);
const Event_KM KM_Controller::DEF_FIRE(Event_KM::CTRL_M,sf::Mouse::Left);
/*GP_Controller*/
const Event_GPB GP_Controller::DEF_ACC(fdx::fighter::Event_GPB::A);
const Event_GPB GP_Controller::DEF_BRAKE(fdx::fighter::Event_GPB::B);
const Event_GPB GP_Controller::DEF_FIRE(fdx::fighter::Event_GPB::X);
/*Variables*/
//Controllers
Selected_Controller controllers;
const Event_GPS GP_Controller::DEF_STICK(fdx::fighter::Event_GPS::LSX,fdx::arrow::Vct(0,0));
/* Functions */
/*Fps_manager*/
//FPS counter
//Pass to the next frame
void Fps_manager::upd_frame()
{
++frames;
tm_tick tsu=(tm.getElapsedTime()-counter).asMilliseconds();//Time since last update
if(tsu>=TM_UPD_TXT)
{
counter=tm.getElapsedTime();
std::ostringstream ss;
ss<<"FPS: "<<(frames/(tsu*0.001));//Converse milliseconds to seconds
frames=0;
txt.setString(ss.str());
}
}
}}//End of namespace