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 /platform/server | |
parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) |
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 'platform/server')
-rw-r--r-- | platform/server/godot_server.cpp | 6 | ||||
-rw-r--r-- | platform/server/os_server.cpp | 75 | ||||
-rw-r--r-- | platform/server/os_server.h | 34 |
3 files changed, 46 insertions, 69 deletions
diff --git a/platform/server/godot_server.cpp b/platform/server/godot_server.cpp index 37e73d663d..d06ade4a57 100644 --- a/platform/server/godot_server.cpp +++ b/platform/server/godot_server.cpp @@ -29,12 +29,12 @@ #include "main/main.h" #include "os_server.h" -int main(int argc, char* argv[]) { +int main(int argc, char *argv[]) { OS_Server os; - Error err = Main::setup(argv[0],argc-1,&argv[1]); - if (err!=OK) + Error err = Main::setup(argv[0], argc - 1, &argv[1]); + if (err != OK) return 255; if (Main::start()) diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index ee80080b4e..f44d976bd6 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -29,10 +29,10 @@ //#include "servers/visual/visual_server_raster.h" //#include "servers/visual/rasterizer_dummy.h" #include "os_server.h" -#include <stdio.h> -#include <stdlib.h> #include "print_string.h" #include "servers/physics/physics_server_sw.h" +#include <stdio.h> +#include <stdlib.h> #include "main/main.h" @@ -42,20 +42,20 @@ int OS_Server::get_video_driver_count() const { return 1; } -const char * OS_Server::get_video_driver_name(int p_driver) const { +const char *OS_Server::get_video_driver_name(int p_driver) const { return "Dummy"; } OS::VideoMode OS_Server::get_default_video_mode() const { - return OS::VideoMode(800,600,false); + return OS::VideoMode(800, 600, false); } -void OS_Server::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) { +void OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { - args=OS::get_singleton()->get_cmdline_args(); - current_videomode=p_desired; - main_loop=NULL; + args = OS::get_singleton()->get_cmdline_args(); + current_videomode = p_desired; + main_loop = NULL; //rasterizer = memnew( RasterizerDummy ); @@ -63,40 +63,37 @@ void OS_Server::initialize(const VideoMode& p_desired,int p_video_driver,int p_a AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); - if (AudioDriverManager::get_driver(p_audio_driver)->init()!=OK) { + if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) { ERR_PRINT("Initializing audio failed."); } - sample_manager = memnew( SampleManagerMallocSW ); - audio_server = memnew( AudioServerSW(sample_manager) ); + sample_manager = memnew(SampleManagerMallocSW); + audio_server = memnew(AudioServerSW(sample_manager)); audio_server->init(); - spatial_sound_server = memnew( SpatialSoundServerSW ); + spatial_sound_server = memnew(SpatialSoundServerSW); spatial_sound_server->init(); - spatial_sound_2d_server = memnew( SpatialSound2DServerSW ); + spatial_sound_2d_server = memnew(SpatialSound2DServerSW); spatial_sound_2d_server->init(); - ERR_FAIL_COND(!visual_server); visual_server->init(); // - physics_server = memnew( PhysicsServerSW ); + physics_server = memnew(PhysicsServerSW); physics_server->init(); - physics_2d_server = memnew( Physics2DServerSW ); + physics_2d_server = memnew(Physics2DServerSW); physics_2d_server->init(); - input = memnew( InputDefault ); + input = memnew(InputDefault); _ensure_data_dir(); - - } void OS_Server::finalize() { - if(main_loop) + if (main_loop) memdelete(main_loop); - main_loop=NULL; + main_loop = NULL; spatial_sound_server->finish(); memdelete(spatial_sound_server); @@ -130,12 +127,10 @@ void OS_Server::finalize() { } void OS_Server::set_mouse_show(bool p_show) { - - } void OS_Server::set_mouse_grab(bool p_grab) { - grab=p_grab; + grab = p_grab; } bool OS_Server::is_mouse_grab_enabled() const { @@ -152,14 +147,10 @@ Point2 OS_Server::get_mouse_pos() const { return Point2(); } -void OS_Server::set_window_title(const String& p_title) { - - +void OS_Server::set_window_title(const String &p_title) { } -void OS_Server::set_video_mode(const VideoMode& p_video_mode,int p_screen) { - - +void OS_Server::set_video_mode(const VideoMode &p_video_mode, int p_screen) { } OS::VideoMode OS_Server::get_video_mode(int p_screen) const { @@ -168,15 +159,12 @@ OS::VideoMode OS_Server::get_video_mode(int p_screen) const { Size2 OS_Server::get_window_size() const { - return Vector2(current_videomode.width,current_videomode.height) ; + return Vector2(current_videomode.width, current_videomode.height); } -void OS_Server::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const { - - +void OS_Server::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const { } - MainLoop *OS_Server::get_main_loop() const { return main_loop; @@ -186,12 +174,12 @@ void OS_Server::delete_main_loop() { if (main_loop) memdelete(main_loop); - main_loop=NULL; + main_loop = NULL; } -void OS_Server::set_main_loop( MainLoop * p_main_loop ) { +void OS_Server::set_main_loop(MainLoop *p_main_loop) { - main_loop=p_main_loop; + main_loop = p_main_loop; input->set_main_loop(p_main_loop); } @@ -200,21 +188,15 @@ bool OS_Server::can_draw() const { return false; //can never draw }; - String OS_Server::get_name() { return "Server"; } - - void OS_Server::move_window_to_foreground() { - } void OS_Server::set_cursor_shape(CursorShape p_shape) { - - } PowerState OS_Server::get_power_state() { @@ -240,7 +222,7 @@ void OS_Server::run() { while (!force_quit) { - if (Main::iteration()==true) + if (Main::iteration() == true) break; }; @@ -251,6 +233,5 @@ OS_Server::OS_Server() { AudioDriverManager::add_driver(&driver_dummy); //adriver here - grab=false; - + grab = false; }; diff --git a/platform/server/os_server.h b/platform/server/os_server.h index a035076726..7484d70e06 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -29,16 +29,16 @@ #ifndef OS_SERVER_H #define OS_SERVER_H -#include "main/input_default.h" +#include "../x11/power_x11.h" +#include "drivers/rtaudio/audio_driver_rtaudio.h" #include "drivers/unix/os_unix.h" -#include "servers/visual_server.h" -#include "servers/visual/rasterizer.h" +#include "main/input_default.h" #include "servers/audio/audio_driver_dummy.h" -#include "servers/physics_server.h" #include "servers/audio_server.h" -#include "drivers/rtaudio/audio_driver_rtaudio.h" #include "servers/physics_2d/physics_2d_server_sw.h" -#include "../x11/power_x11.h" +#include "servers/physics_server.h" +#include "servers/visual/rasterizer.h" +#include "servers/visual_server.h" //bitch #undef CursorShape @@ -66,24 +66,20 @@ class OS_Server : public OS_Unix { bool force_quit; InputDefault *input; - - PowerX11 *power_manager; - + PowerX11 *power_manager; protected: - virtual int get_video_driver_count() const; - virtual const char * get_video_driver_name(int p_driver) const; + virtual const char *get_video_driver_name(int p_driver) const; virtual VideoMode get_default_video_mode() const; - virtual void initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver); + virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); virtual void finalize(); - virtual void set_main_loop( MainLoop * p_main_loop ); + virtual void set_main_loop(MainLoop *p_main_loop); public: - virtual String get_name(); virtual void set_cursor_shape(CursorShape p_shape); @@ -93,22 +89,22 @@ public: virtual bool is_mouse_grab_enabled() const; virtual Point2 get_mouse_pos() const; virtual int get_mouse_button_state() const; - virtual void set_window_title(const String& p_title); + virtual void set_window_title(const String &p_title); virtual MainLoop *get_main_loop() const; virtual bool can_draw() const; - virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); - virtual VideoMode get_video_mode(int p_screen=0) const; - virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const; + virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0); + virtual VideoMode get_video_mode(int p_screen = 0) const; + virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const; virtual Size2 get_window_size() const; virtual void move_window_to_foreground(); void run(); - + virtual PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); |