Skip to content

Commit 29e0c3d

Browse files
author
Blaž Hrastnik
committed
ls modules/**/*.[hc]xx | xargs clang-format -i -style="{PointerAlignment: Left, BasedOnStyle: Mozilla}"
1 parent f7fab0a commit 29e0c3d

51 files changed

Lines changed: 1575 additions & 776 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/audio-gorilla/include/moon/gorilla/audio.hxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
#include <gorilla/gau.h>
77

88
namespace Moon {
9-
class Audio {
9+
class Audio
10+
{
1011
public:
1112
static bool Initialize();
1213
static void Update();

modules/audio-gorilla/include/moon/gorilla/music.hxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
#include "moon/gorilla/audio.hxx"
55

66
namespace Moon {
7-
struct Music {
8-
Music() : handle(NULL), loopSrc(NULL){};
7+
struct Music
8+
{
9+
Music()
10+
: handle(NULL)
11+
, loopSrc(NULL){};
912
ga_Handle* handle;
1013
gau_SampleSourceLoop* loopSrc;
1114
};

modules/audio-gorilla/src/audio.cxx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ gau_Manager* Audio::m_mgr = NULL;
55
ga_Mixer* Audio::m_mixer = NULL;
66
ga_StreamManager* Audio::m_streamMgr = NULL;
77

8-
bool Audio::Initialize() {
8+
bool
9+
Audio::Initialize()
10+
{
911
// setup Gorilla Audio
1012
if (!m_mgr) {
1113
if (gc_initialize(0) == GC_SUCCESS) {
@@ -19,13 +21,17 @@ bool Audio::Initialize() {
1921
return true;
2022
};
2123

22-
void Audio::Update() {
24+
void
25+
Audio::Update()
26+
{
2327
if (m_mgr) {
2428
gau_manager_update(m_mgr);
2529
}
2630
};
2731

28-
void Audio::Terminate() {
32+
void
33+
Audio::Terminate()
34+
{
2935
if (m_mgr) {
3036
gau_manager_destroy(m_mgr);
3137
gc_shutdown();
@@ -35,7 +41,15 @@ void Audio::Terminate() {
3541
}
3642
};
3743

38-
ga_Mixer* Audio::GetMixer() { return m_mixer; };
44+
ga_Mixer*
45+
Audio::GetMixer()
46+
{
47+
return m_mixer;
48+
};
3949

40-
ga_StreamManager* Audio::GetStreamMgr() { return m_streamMgr; };
50+
ga_StreamManager*
51+
Audio::GetStreamMgr()
52+
{
53+
return m_streamMgr;
54+
};
4155
}

modules/audio-gorilla/src/mrb_moon_audio.cxx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,28 @@
66

77
/* Call once per step/frame to update the internal Audio module.
88
*/
9-
static mrb_value audio_update(mrb_state* mrb, mrb_value klass) {
9+
static mrb_value
10+
audio_update(mrb_state* mrb, mrb_value klass)
11+
{
1012
Moon::Audio::Update();
1113
return klass;
1214
}
1315

14-
MOON_C_API void mrb_mruby_moon_audio_gorilla_gem_init(mrb_state* mrb) {
16+
MOON_C_API void
17+
mrb_mruby_moon_audio_gorilla_gem_init(mrb_state* mrb)
18+
{
1519
struct RClass* moon_module = mrb_define_module(mrb, "Moon");
1620
struct RClass* audio_module =
17-
mrb_define_module_under(mrb, moon_module, "Audio");
21+
mrb_define_module_under(mrb, moon_module, "Audio");
1822
mrb_define_class_method(mrb, audio_module, "update", audio_update,
1923
MRB_ARGS_NONE());
2024
mmrb_music_init(mrb);
2125
mmrb_sound_init(mrb);
2226
Moon::Audio::Initialize();
2327
}
2428

25-
MOON_C_API void mrb_mruby_moon_audio_gorilla_gem_final(mrb_state* mrb) {
29+
MOON_C_API void
30+
mrb_mruby_moon_audio_gorilla_gem_final(mrb_state* mrb)
31+
{
2632
Moon::Audio::Terminate();
2733
}

modules/audio-gorilla/src/mrb_music.cxx

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#include <mruby/data.h>
88
#include <mruby/numeric.h>
99

10-
static void music_free(mrb_state* mrb, void* p) {
10+
static void
11+
music_free(mrb_state* mrb, void* p)
12+
{
1113
Moon::Music* music = (Moon::Music*)p;
1214
if (music) {
1315
if (music->handle) {
@@ -17,9 +19,11 @@ static void music_free(mrb_state* mrb, void* p) {
1719
}
1820
}
1921

20-
MOON_C_API const struct mrb_data_type music_data_type = {"Music", music_free};
22+
MOON_C_API const struct mrb_data_type music_data_type = { "Music", music_free };
2123

22-
static inline Moon::Music* get_music(mrb_state* mrb, mrb_value self) {
24+
static inline Moon::Music*
25+
get_music(mrb_state* mrb, mrb_value self)
26+
{
2327
return (Moon::Music*)mrb_data_get_ptr(mrb, self, &music_data_type);
2428
}
2529

@@ -28,7 +32,9 @@ static inline Moon::Music* get_music(mrb_state* mrb, mrb_value self) {
2832
* @param [String] format type of the file
2933
* @return [Music]
3034
*/
31-
static mrb_value music_initialize(mrb_state* mrb, mrb_value self) {
35+
static mrb_value
36+
music_initialize(mrb_state* mrb, mrb_value self)
37+
{
3238
char* filename;
3339
char* format;
3440
Moon::Music* music;
@@ -43,8 +49,8 @@ static mrb_value music_initialize(mrb_state* mrb, mrb_value self) {
4349

4450
if (exists(filename)) {
4551
music->handle = gau_create_handle_buffered_file(
46-
Moon::Audio::GetMixer(), Moon::Audio::GetStreamMgr(), filename, format,
47-
NULL, 0, &(music->loopSrc));
52+
Moon::Audio::GetMixer(), Moon::Audio::GetStreamMgr(), filename, format,
53+
NULL, 0, &(music->loopSrc));
4854
} else {
4955
mrb_raisef(mrb, E_SCRIPT_ERROR, "cannot load such file -- %S",
5056
mrb_str_new_cstr(mrb, filename));
@@ -62,7 +68,9 @@ static mrb_value music_initialize(mrb_state* mrb, mrb_value self) {
6268
* @param [Float] pan
6369
* @return [nil]
6470
*/
65-
static mrb_value music_play(mrb_state* mrb, mrb_value self) {
71+
static mrb_value
72+
music_play(mrb_state* mrb, mrb_value self)
73+
{
6674
mrb_float gain = 1.0;
6775
mrb_float pitch = 1.0;
6876
mrb_float pan = 0.0;
@@ -79,7 +87,9 @@ static mrb_value music_play(mrb_state* mrb, mrb_value self) {
7987
/* Stops the playback.
8088
* @return [nil]
8189
*/
82-
static mrb_value music_stop(mrb_state* mrb, mrb_value self) {
90+
static mrb_value
91+
music_stop(mrb_state* mrb, mrb_value self)
92+
{
8393
Moon::Music* music = get_music(mrb, self);
8494
ga_handle_stop(music->handle);
8595
return mrb_nil_value();
@@ -89,7 +99,9 @@ static mrb_value music_stop(mrb_state* mrb, mrb_value self) {
8999
*
90100
* @return [Boolean] Returns true if currently playing, else false.
91101
*/
92-
static mrb_value music_is_playing(mrb_state* mrb, mrb_value self) {
102+
static mrb_value
103+
music_is_playing(mrb_state* mrb, mrb_value self)
104+
{
93105
Moon::Music* music = get_music(mrb, self);
94106
return mrb_bool_value(ga_handle_playing(music->handle));
95107
}
@@ -98,7 +110,9 @@ static mrb_value music_is_playing(mrb_state* mrb, mrb_value self) {
98110
*
99111
* @return [Boolean] Returns true if currently stopped, else false.
100112
*/
101-
static mrb_value music_is_stopped(mrb_state* mrb, mrb_value self) {
113+
static mrb_value
114+
music_is_stopped(mrb_state* mrb, mrb_value self)
115+
{
102116
Moon::Music* music = get_music(mrb, self);
103117
return mrb_bool_value(ga_handle_stopped(music->handle));
104118
}
@@ -107,7 +121,9 @@ static mrb_value music_is_stopped(mrb_state* mrb, mrb_value self) {
107121
*
108122
* @return [Boolean] Returns true if the playback is finished, else false.
109123
*/
110-
static mrb_value music_is_finished(mrb_state* mrb, mrb_value self) {
124+
static mrb_value
125+
music_is_finished(mrb_state* mrb, mrb_value self)
126+
{
111127
Moon::Music* music = get_music(mrb, self);
112128
return mrb_bool_value(ga_handle_finished(music->handle));
113129
}
@@ -117,7 +133,9 @@ static mrb_value music_is_finished(mrb_state* mrb, mrb_value self) {
117133
* @param [Integer] pos Offset from the start of the file, in seconds.
118134
* @return [Boolean] Returns true if the seek was successful, else false.
119135
*/
120-
static mrb_value music_seek(mrb_state* mrb, mrb_value self) {
136+
static mrb_value
137+
music_seek(mrb_state* mrb, mrb_value self)
138+
{
121139
mrb_int pos;
122140
Moon::Music* music = get_music(mrb, self);
123141
mrb_get_args(mrb, "i", &pos);
@@ -128,7 +146,9 @@ static mrb_value music_seek(mrb_state* mrb, mrb_value self) {
128146
*
129147
* @return [Integer] Current position in the file (in seconds).
130148
*/
131-
static mrb_value music_pos(mrb_state* mrb, mrb_value self) {
149+
static mrb_value
150+
music_pos(mrb_state* mrb, mrb_value self)
151+
{
132152
Moon::Music* music = get_music(mrb, self);
133153
return mrb_fixnum_value(ga_handle_tell(music->handle, GA_TELL_PARAM_CURRENT));
134154
}
@@ -137,7 +157,9 @@ static mrb_value music_pos(mrb_state* mrb, mrb_value self) {
137157
*
138158
* @return [Integer] Total length (in seconds).
139159
*/
140-
static mrb_value music_length(mrb_state* mrb, mrb_value self) {
160+
static mrb_value
161+
music_length(mrb_state* mrb, mrb_value self)
162+
{
141163
Moon::Music* music = get_music(mrb, self);
142164
return mrb_fixnum_value(ga_handle_tell(music->handle, GA_TELL_PARAM_TOTAL));
143165
}
@@ -148,7 +170,9 @@ static mrb_value music_length(mrb_state* mrb, mrb_value self) {
148170
* @param [Integer] target position (in samples) where to jump to
149171
* @return [nil]
150172
*/
151-
static mrb_value music_loop(mrb_state* mrb, mrb_value self) {
173+
static mrb_value
174+
music_loop(mrb_state* mrb, mrb_value self)
175+
{
152176
mrb_int trigger = -1;
153177
mrb_int target = 0;
154178
Moon::Music* music = get_music(mrb, self);
@@ -161,20 +185,24 @@ static mrb_value music_loop(mrb_state* mrb, mrb_value self) {
161185
*
162186
* @return [Boolean] true
163187
*/
164-
static mrb_value music_clear_loop(mrb_state* mrb, mrb_value self) {
188+
static mrb_value
189+
music_clear_loop(mrb_state* mrb, mrb_value self)
190+
{
165191
Moon::Music* music = get_music(mrb, self);
166192
gau_sample_source_loop_clear(music->loopSrc);
167193
return mrb_bool_value(true);
168194
}
169195

170-
MOON_C_API void mmrb_music_init(mrb_state* mrb) {
196+
MOON_C_API void
197+
mmrb_music_init(mrb_state* mrb)
198+
{
171199
struct RClass* mod = mrb_define_module(mrb, "Moon");
172200
/* Music used to playing audio streams (usually background music). The file is
173201
* buffered from disk instead of streamed from memory, because songs can be
174202
* rather large in file size.
175203
*/
176204
struct RClass* music_class =
177-
mrb_define_class_under(mrb, mod, "Music", mrb->object_class);
205+
mrb_define_class_under(mrb, mod, "Music", mrb->object_class);
178206
MRB_SET_INSTANCE_TT(music_class, MRB_TT_DATA);
179207

180208
mrb_define_method(mrb, music_class, "initialize", music_initialize,

modules/audio-gorilla/src/mrb_sound.cxx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
#include <mruby/data.h>
88
#include <mruby/numeric.h>
99

10-
static void sound_free(mrb_state* mrb, void* p) {
10+
static void
11+
sound_free(mrb_state* mrb, void* p)
12+
{
1113
ga_Sound* sound = (ga_Sound*)p;
1214
if (sound) {
1315
delete (sound);
1416
}
1517
}
1618

17-
MOON_C_API const struct mrb_data_type sound_data_type = {"Sound", sound_free};
19+
MOON_C_API const struct mrb_data_type sound_data_type = { "Sound", sound_free };
1820

19-
static inline ga_Sound* get_sound(mrb_state* mrb, mrb_value self) {
21+
static inline ga_Sound*
22+
get_sound(mrb_state* mrb, mrb_value self)
23+
{
2024
return (ga_Sound*)mrb_data_get_ptr(mrb, self, &sound_data_type);
2125
}
2226

@@ -25,7 +29,9 @@ static inline ga_Sound* get_sound(mrb_state* mrb, mrb_value self) {
2529
* @param [String] format type of the file
2630
* @return [Sound]
2731
*/
28-
static mrb_value sound_initialize(mrb_state* mrb, mrb_value self) {
32+
static mrb_value
33+
sound_initialize(mrb_state* mrb, mrb_value self)
34+
{
2935
char* filename;
3036
char* format;
3137
ga_Sound* sound;
@@ -57,7 +63,9 @@ static mrb_value sound_initialize(mrb_state* mrb, mrb_value self) {
5763
* @param [Float] pan
5864
* @return [nil]
5965
*/
60-
static mrb_value sound_play(mrb_state* mrb, mrb_value self) {
66+
static mrb_value
67+
sound_play(mrb_state* mrb, mrb_value self)
68+
{
6169
mrb_float gain = 1.0;
6270
mrb_float pitch = 1.0;
6371
mrb_float pan = 0.0;
@@ -74,7 +82,9 @@ static mrb_value sound_play(mrb_state* mrb, mrb_value self) {
7482
return mrb_nil_value();
7583
}
7684

77-
MOON_C_API void mmrb_sound_init(mrb_state* mrb) {
85+
MOON_C_API void
86+
mmrb_sound_init(mrb_state* mrb)
87+
{
7888
struct RClass* mod = mrb_define_module(mrb, "Moon");
7989
/* Sounds are short audio files (usually used for sound effects) that are
8090
* played back often. We fully read them into memory to avoid expensive disk
@@ -83,7 +93,7 @@ MOON_C_API void mmrb_sound_init(mrb_state* mrb) {
8393
* Use {Music} if you want to play longer audio/music streams.
8494
*/
8595
struct RClass* sound_class =
86-
mrb_define_class_under(mrb, mod, "Sound", mrb->object_class);
96+
mrb_define_class_under(mrb, mod, "Sound", mrb->object_class);
8797
MRB_SET_INSTANCE_TT(sound_class, MRB_TT_DATA);
8898

8999
mrb_define_method(mrb, sound_class, "initialize", sound_initialize,
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
#include "moon/portaudio/audio.hxx"
22

33
namespace Moon {
4-
void Audio::Initialize() {}
4+
void
5+
Audio::Initialize()
6+
{
7+
}
58

6-
void Audio::Update() {}
9+
void
10+
Audio::Update()
11+
{
12+
}
713

8-
void Audio::Terminate() {}
14+
void
15+
Audio::Terminate()
16+
{
17+
}
918
}

modules/graphics/include/moon/font.hxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#include <freetype-gl.h>
1212

1313
namespace Moon {
14-
class Font {
14+
class Font
15+
{
1516
public:
1617
texture_font_t* font;
1718
texture_atlas_t* atlas;

modules/graphics/include/moon/graphics.hxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
#include "moon/vector4.hxx"
66

77
namespace Moon {
8-
struct Vertex {
8+
struct Vertex
9+
{
910
Vector2 pos;
1011
Vector2 tex_coord;
1112
Vector4 color;
1213

1314
Vertex(){};
1415
Vertex(Vector2 _pos, Vector2 _tex_coord, Vector4 _color)
15-
: pos(_pos), tex_coord(_tex_coord), color(_color){};
16+
: pos(_pos)
17+
, tex_coord(_tex_coord)
18+
, color(_color){};
1619
};
1720
}
1821
#endif

0 commit comments

Comments
 (0)