-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatting #369
base: dev
Are you sure you want to change the base?
Formatting #369
Conversation
src/main.c
Outdated
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS | ||
#include "IconsForkAwesome.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Includes should not be moved past defines.
|
||
#define SE_MAX_CONTROL_POINTS 32 | ||
#define SE_REGION_NAME 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make it not break aligned numbers like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right I will try to see if I can make it do that
src/main.c
Outdated
uint32_t version_code; | ||
uint8_t palettes[5*4]; | ||
uint32_t version_code; | ||
uint8_t palettes[5 * 4]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- and / should not be wrapped in spaces (but + and - should be wrapped in spaces) to improve readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhm ok sounds like a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang format does unfortunately not seem to support this (?)
is this a deal breaker? It seems to want to have spaces between most operators.
src/main.c
Outdated
static bool se_draw_theme_region_tint(int region, float x, float y, float w, float h,uint32_t tint); | ||
static bool se_draw_theme_region_tint_partial(int region, float x, float y, float w, float h, float w_ratio, float h_ratio, uint32_t tint); | ||
static const char* se_get_pref_path(){ | ||
static bool se_load_theme_from_file(const char *filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't auto word wrap long lines.
src/main.c
Outdated
dpi_scale = sapp_dpi_scale(); | ||
if(dpi_scale<=0)dpi_scale=1.; | ||
dpi_scale*=1.10; | ||
if (dpi_scale <= 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- if/while should not have spaces between "("
- if statements without {} should always be on the same line as their statement (it prevents bugs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we always want {} to create a new line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, leave it up to the programmer to put the new lines if they want it.
src/main.c
Outdated
const utf8proc_uint8_t *str = (const utf8proc_uint8_t *)input_string; | ||
while(str[0]){ | ||
while (str[0]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no space between ) and {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't seem to be an option sadly
str += size; | ||
if (codepoint_ref > SE_MAX_UNICODE_CODE_POINT) | ||
continue; | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did this extra semicolon come from?
src/main.c
Outdated
static inline const char* se_localize_and_cache(const char* input_str){ | ||
const char * localized_string = se_localize(input_str); | ||
static inline const char *se_localize_and_cache(const char *input_str) { | ||
const char *localized_string = se_localize(input_str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you configure the formatting to not touch the location of * in variable names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dunno but I will try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No sadly, it does not seem like it, but we can tell it to put pointers to the left, right or in the middle. Maybe I simply missed it in the docs because it does feel like it should be an option but it is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it still format them even if you don't have a PointerAlignment
field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope it defaults to right alignment if I do that.
const char* se_keycode_to_string(int keycode){ | ||
switch(keycode){ | ||
default: return "Unknown"; | ||
case SAPP_KEYCODE_SPACE: return "SPACE"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to not break up these case labels and the returns onto separate lines.
They are laid out like this to allow block edits.
src/gba_bios.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't format this file
src/nds_rom_database.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't format this file
src/lcd_shaders.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't format this file
184ddd6
to
859c1e1
Compare
242f3d9
to
81fb1ed
Compare
src/main.c
Outdated
"Toggle Full Screen" | ||
}; | ||
const static char *se_keybind_names[SE_NUM_KEYBINDS] = { | ||
"A", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only be 2 spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want a tab width of 2 spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix that
// Utilize a watchdog channel to detect if the audio context has encountered an error | ||
// and restart it if a problem occurred. | ||
int audio_watchdog_timer; | ||
int audio_watchdog_triggered; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing here is a bit long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spacing is long in order to have alignment, we could add newlines between the lines to alleviate that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
things like this may happen a bit everywhere though so declarations are aligned, it is sadly impossible as far as I can see to give it a sort of threshold.
a3c27a8
to
0b70c63
Compare
Added a formatting script to format the project, and crated a clang-format script using the LLVM formatting style. If we want another style it is a simple fix!