diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /main/performance.cpp | |
parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
download | redot-engine-5dbf1809c6e3e905b94b8764e99491e608122261.tar.gz |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'main/performance.cpp')
-rw-r--r-- | main/performance.cpp | 95 |
1 files changed, 43 insertions, 52 deletions
diff --git a/main/performance.cpp b/main/performance.cpp index bc5d8c33c4..d566bc325f 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -27,57 +27,53 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "performance.h" +#include "message_queue.h" #include "os/os.h" -#include "servers/visual_server.h" +#include "scene/main/scene_main_loop.h" #include "servers/physics_2d_server.h" #include "servers/physics_server.h" -#include "message_queue.h" -#include "scene/main/scene_main_loop.h" -Performance *Performance::singleton=NULL; - - - +#include "servers/visual_server.h" +Performance *Performance::singleton = NULL; void Performance::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_monitor","monitor"),&Performance::get_monitor); - - BIND_CONSTANT( TIME_FPS ); - BIND_CONSTANT( TIME_PROCESS ); - BIND_CONSTANT( TIME_FIXED_PROCESS ); - BIND_CONSTANT( MEMORY_STATIC ); - BIND_CONSTANT( MEMORY_DYNAMIC ); - BIND_CONSTANT( MEMORY_STATIC_MAX ); - BIND_CONSTANT( MEMORY_DYNAMIC_MAX ); - BIND_CONSTANT( MEMORY_MESSAGE_BUFFER_MAX ); - BIND_CONSTANT( OBJECT_COUNT ); - BIND_CONSTANT( OBJECT_RESOURCE_COUNT ); - BIND_CONSTANT( OBJECT_NODE_COUNT ); - BIND_CONSTANT( RENDER_OBJECTS_IN_FRAME ); - BIND_CONSTANT( RENDER_VERTICES_IN_FRAME ); - BIND_CONSTANT( RENDER_MATERIAL_CHANGES_IN_FRAME ); - BIND_CONSTANT( RENDER_SHADER_CHANGES_IN_FRAME ); - BIND_CONSTANT( RENDER_SURFACE_CHANGES_IN_FRAME ); - BIND_CONSTANT( RENDER_DRAW_CALLS_IN_FRAME ); - BIND_CONSTANT( RENDER_USAGE_VIDEO_MEM_TOTAL ); - BIND_CONSTANT( RENDER_VIDEO_MEM_USED ); - BIND_CONSTANT( RENDER_TEXTURE_MEM_USED ); - BIND_CONSTANT( RENDER_VERTEX_MEM_USED ); - BIND_CONSTANT( PHYSICS_2D_ACTIVE_OBJECTS ); - BIND_CONSTANT( PHYSICS_2D_COLLISION_PAIRS ); - BIND_CONSTANT( PHYSICS_2D_ISLAND_COUNT ); - BIND_CONSTANT( PHYSICS_3D_ACTIVE_OBJECTS ); - BIND_CONSTANT( PHYSICS_3D_COLLISION_PAIRS ); - BIND_CONSTANT( PHYSICS_3D_ISLAND_COUNT ); - - BIND_CONSTANT( MONITOR_MAX ); - + ClassDB::bind_method(D_METHOD("get_monitor", "monitor"), &Performance::get_monitor); + + BIND_CONSTANT(TIME_FPS); + BIND_CONSTANT(TIME_PROCESS); + BIND_CONSTANT(TIME_FIXED_PROCESS); + BIND_CONSTANT(MEMORY_STATIC); + BIND_CONSTANT(MEMORY_DYNAMIC); + BIND_CONSTANT(MEMORY_STATIC_MAX); + BIND_CONSTANT(MEMORY_DYNAMIC_MAX); + BIND_CONSTANT(MEMORY_MESSAGE_BUFFER_MAX); + BIND_CONSTANT(OBJECT_COUNT); + BIND_CONSTANT(OBJECT_RESOURCE_COUNT); + BIND_CONSTANT(OBJECT_NODE_COUNT); + BIND_CONSTANT(RENDER_OBJECTS_IN_FRAME); + BIND_CONSTANT(RENDER_VERTICES_IN_FRAME); + BIND_CONSTANT(RENDER_MATERIAL_CHANGES_IN_FRAME); + BIND_CONSTANT(RENDER_SHADER_CHANGES_IN_FRAME); + BIND_CONSTANT(RENDER_SURFACE_CHANGES_IN_FRAME); + BIND_CONSTANT(RENDER_DRAW_CALLS_IN_FRAME); + BIND_CONSTANT(RENDER_USAGE_VIDEO_MEM_TOTAL); + BIND_CONSTANT(RENDER_VIDEO_MEM_USED); + BIND_CONSTANT(RENDER_TEXTURE_MEM_USED); + BIND_CONSTANT(RENDER_VERTEX_MEM_USED); + BIND_CONSTANT(PHYSICS_2D_ACTIVE_OBJECTS); + BIND_CONSTANT(PHYSICS_2D_COLLISION_PAIRS); + BIND_CONSTANT(PHYSICS_2D_ISLAND_COUNT); + BIND_CONSTANT(PHYSICS_3D_ACTIVE_OBJECTS); + BIND_CONSTANT(PHYSICS_3D_COLLISION_PAIRS); + BIND_CONSTANT(PHYSICS_3D_ISLAND_COUNT); + + BIND_CONSTANT(MONITOR_MAX); } String Performance::get_monitor_name(Monitor p_monitor) const { - ERR_FAIL_INDEX_V(p_monitor,MONITOR_MAX,String()); - static const char* names[MONITOR_MAX]={ + ERR_FAIL_INDEX_V(p_monitor, MONITOR_MAX, String()); + static const char *names[MONITOR_MAX] = { "time/fps", "time/process", @@ -110,14 +106,11 @@ String Performance::get_monitor_name(Monitor p_monitor) const { }; return names[p_monitor]; - - } - float Performance::get_monitor(Monitor p_monitor) const { - switch(p_monitor) { + switch (p_monitor) { case TIME_FPS: return Engine::get_singleton()->get_frames_per_second(); case TIME_PROCESS: return _process_time; case TIME_FIXED_PROCESS: return _fixed_process_time; @@ -137,7 +130,6 @@ float Performance::get_monitor(Monitor p_monitor) const { if (!sml) return 0; return sml->get_node_count(); - }; case RENDER_OBJECTS_IN_FRAME: return VS::get_singleton()->get_render_info(VS::INFO_OBJECTS_IN_FRAME); case RENDER_VERTICES_IN_FRAME: return VS::get_singleton()->get_render_info(VS::INFO_VERTICES_IN_FRAME); @@ -164,18 +156,17 @@ float Performance::get_monitor(Monitor p_monitor) const { void Performance::set_process_time(float p_pt) { - _process_time=p_pt; + _process_time = p_pt; } void Performance::set_fixed_process_time(float p_pt) { - _fixed_process_time=p_pt; + _fixed_process_time = p_pt; } - Performance::Performance() { - _process_time=0; - _fixed_process_time=0; - singleton=this; + _process_time = 0; + _fixed_process_time = 0; + singleton = this; } |