diff --git a/External/tely b/External/tely index b4b45f8..833c1c5 160000 --- a/External/tely +++ b/External/tely @@ -1 +1 @@ -Subproject commit b4b45f8d7cf37a4fced06d8afe4a693ee0604823 +Subproject commit 833c1c5a7c62ac89442da56cf2453edb6954841b diff --git a/_clang-format b/_clang-format new file mode 100644 index 0000000..a123814 --- /dev/null +++ b/_clang-format @@ -0,0 +1,462 @@ +Language: Cpp + +IndentWidth: 4 +TabWidth: 4 + +# Align parameters on the open bracket, e.g.: +# someLongFunction(argument1, +# argument2); +AlignAfterOpenBracket: Align + +# Align array column and left justify the columns e.g.: +# struct test demo[] = +# { +# {56, 23, "hello"}, +# {-1, 93463, "world"}, +# {7, 5, "!!" } +# }; +AlignArrayOfStructures: Left + +# Align assignments on consecutive lines. This will result in formattings like: +# +# int a = 1; +# int somelongname = 2; +# double c = 3; +# +# int d = 3; +# /* A comment. */ +# double e = 4; +AlignConsecutiveAssignments: Consecutive +AlignConsecutiveBitFields: Consecutive +AlignConsecutiveDeclarations: Consecutive +AlignConsecutiveMacros: Consecutive + +# Align escaped newlines as far left as possible. +# #define A \ +# int aaaa; \ +# int b; \ +# int dddddddddd; +AlignEscapedNewlines: Left + +# Horizontally align operands of binary and ternary expressions. +# Specifically, this aligns operands of a single expression that needs to be +# split over multiple lines, e.g.: +# +# int aaa = bbbbbbbbbbbbbbb + +# ccccccccccccccc; +AlignOperands: Align + +# true: false: +# int a; // My comment a vs. int a; // My comment a +# int b = 2; // comment b int b = 2; // comment about b +AlignTrailingComments: true + +# If the function declaration doesn’t fit on a line, allow putting all +# parameters of a function declaration onto the next line even if +# BinPackParameters is false. +# +# true: +# void myFunction( +# int a, int b, int c, int d, int e); +# +# false: +# void myFunction(int a, +# int b, +# int c, +# int d, +# int e); +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Never # "while (true) { continue; }" can be put on a single line. + +# If true, short case labels will be contracted to a single line. +# +# true: false: +# switch (a) { vs. switch (a) { +# case 1: x = 1; break; case 1: +# case 2: return; x = 1; +# } break; +# case 2: +# return; +# } +AllowShortCaseLabelsOnASingleLine: true +AllowShortEnumsOnASingleLine: true # enum { A, B } myEnum; + +# Only merge functions defined inside a class. Implies “empty”. +# +# class Foo { +# void f() { foo(); } +# }; +# void f() { +# foo(); +# } +# void f() {} +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: false + +# Only merge empty lambdas. +# +# auto lambda = [](int a) {} +# auto lambda2 = [](int a) { +# return a; +# }; +AllowShortLambdasOnASingleLine: Empty +AllowShortLoopsOnASingleLine: false + +# true: false: +# aaaa = vs. aaaa = "bbbb" +# "bbbb" "cccc"; +# "cccc"; +AlwaysBreakBeforeMultilineStrings: true + +# Force break after template declaration only when the following declaration +# spans multiple lines. +# +# template T foo() { +# } +# template +# T foo(int aaaaaaaaaaaaaaaaaaaaa, +# int bbbbbbbbbbbbbbbbbbbbb) { +# } +AlwaysBreakTemplateDeclarations: MultiLine + +# If false, a function call’s arguments will either be all on the same line or +# will have one line each. +# +# true: +# void f() { +# f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa, +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); +# } +# +# false: +# void f() { +# f(aaaaaaaaaaaaaaaaaaaa, +# aaaaaaaaaaaaaaaaaaaa, +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); +# } +BinPackArguments: false +BinPackParameters: false # As BinPackArguments but for function definition parameters + +# Add space after the : only (space may be added before if needed for +# AlignConsecutiveBitFields). +# +# unsigned bf: 2; +BitFieldColonSpacing: After + +# LooooooooooongType loooooooooooooooooooooongVariable = +# someLooooooooooooooooongFunction(); +# +# bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa == +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa > +# ccccccccccccccccccccccccccccccccccccccccc; +BreakBeforeBinaryOperators: None + +# Always attach braces to surrounding context, but break before braces on +# function, namespace and class definitions. +BreakBeforeBraces: Linux + +# true: +# template +# concept ... +# +# false: +# template concept ... +BreakBeforeConceptDeclarations: false + +# true: +# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription +# ? firstValue +# : SecondValueVeryVeryVeryVeryLong; +# +# false: +# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ? +# firstValue : +# SecondValueVeryVeryVeryVeryLong; +BreakBeforeTernaryOperators: true + +# Break constructor initializers before the colon and commas, and align the +# commas with the colon. +# +# Constructor() +# : initializer1() +# , initializer2() +BreakConstructorInitializers: BeforeComma + +# Break inheritance list only after the commas. +# +# class Foo : Base1, +# Base2 +# {}; +BreakInheritanceList: AfterComma + +# true: +# const char* x = "veryVeryVeryVeryVeryVe" +# "ryVeryVeryVeryVeryVery" +# "VeryLongString"; +BreakStringLiterals: true +ColumnLimit: 0 + +# false: +# namespace Foo { +# namespace Bar { +# } +# } +CompactNamespaces: false + +# true: false: +# vector x{1, 2, 3, 4}; vs. vector x{ 1, 2, 3, 4 }; +# vector x{{}, {}, {}, {}}; vector x{ {}, {}, {}, {} }; +# f(MyMap[{composite, key}]); f(MyMap[{ composite, key }]); +# new int[3]{1, 2, 3}; new int[3]{ 1, 2, 3 }; +Cpp11BracedListStyle: true + +# Analyze the formatted file for the most used line ending (\r\n or \n). UseCRLF +# is only used as a fallback if none can be derived. +DeriveLineEnding: true +DerivePointerAlignment: true # As per DeriveLineEnding except for pointers and references + +# Add empty line only when access modifier starts a new logical block. Logical +# block is a group of one or more member fields or functions. +# +# struct foo { +# private: +# int i; +# +# protected: +# int j; +# /* comment */ +# public: +# foo() {} +# +# private: +# protected: +# }; +EmptyLineBeforeAccessModifier: LogicalBlock + +# true: false: +# namespace a { vs. namespace a { +# foo(); foo(); +# bar(); bar(); +# } // namespace a } +FixNamespaceComments: true + +# false: true: +# class C { vs. class C { +# class D { class D { +# void bar(); void bar(); +# protected: protected: +# D(); D(); +# }; }; +# public: public: +# C(); C(); +# }; }; +# void foo() { void foo() { +# return 1; return 1; +# } } +IndentAccessModifiers: false + +# false: true: +# switch (fool) { vs. switch (fool) { +# case 1: { case 1: +# bar(); { +# } break; bar(); +# default: { } +# plop(); break; +# } default: +# } { +# plop(); +# } +# } +IndentCaseBlocks: false + +# false: true: +# switch (fool) { vs. switch (fool) { +# case 1: case 1: +# bar(); bar(); +# break; break; +# default: default: +# plop(); plop(); +# } } +IndentCaseLabels: true + +# extern "C" { +# void foo(); +# } +IndentExternBlock: NoIndent + +# Indents directives before the hash. +# +# #if FOO +# #if BAR +# #include +# #endif +# #endif +IndentPPDirectives: BeforeHash + +# true: false: +# if (foo) { vs. if (foo) { +# bar(); +# bar(); } +# } +KeepEmptyLinesAtTheStartOfBlocks: false + +# The maximum number of consecutive empty lines to keep. +# +# MaxEmptyLinesToKeep: 1 vs. MaxEmptyLinesToKeep: 0 +# int f() { int f() { +# int = 1; int i = 1; +# i = foo(); +# i = foo(); return i; +# } +# return i; +# } +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None + +# Put all constructor initializers on the current line if they fit. Otherwise, +# put each one on its own line. +# +# Constructor() : a(), b() +# +# Constructor() +# : aaaaaaaaaaaaaaaaaaaa(), +# bbbbbbbbbbbbbbbbbbbb(), +# ddddddddddddd() +PackConstructorInitializers: CurrentLine +PointerAlignment: Right + +# Different ways to arrange specifiers and qualifiers (e.g. const/volatile). +QualifierAlignment: Custom +QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile'] + +# false: +# // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information +# /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */ +# +# true: +# // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of +# // information +# /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of +# * information */ +ReflowComments: true + +# false: true: +# +# if (isa(D)) { vs. if (isa(D)) +# handleFunctionDecl(D); handleFunctionDecl(D); +# } else if (isa(D)) { else if (isa(D)) +# handleVarDecl(D); handleVarDecl(D); +# } +# +# if (isa(D)) { vs. if (isa(D)) { +# for (auto *A : D.attrs()) { for (auto *A : D.attrs()) +# if (shouldProcessAttr(A)) { if (shouldProcessAttr(A)) +# handleAttr(A); handleAttr(A); +# } } +# } +# } +# +# if (isa(D)) { vs. if (isa(D)) +# for (auto *A : D.attrs()) { for (auto *A : D.attrs()) +# handleAttr(A); handleAttr(A); +# } +# } +# +# if (auto *D = (T)(D)) { vs. if (auto *D = (T)(D)) { +# if (shouldProcess(D)) { if (shouldProcess(D)) +# handleVarDecl(D); handleVarDecl(D); +# } else { else +# markAsIgnored(D); markAsIgnored(D); +# } } +# } +# +# if (a) { vs. if (a) +# b(); b(); +# } else { else if (c) +# if (c) { d(); +# d(); else +# } else { e(); +# e(); +# } +# } +RemoveBracesLLVM: true + +# Never v.s. Always +# #include #include +# struct Foo { +# int a, b, c; struct Foo { +# }; int a, b, c; +# namespace Ns { }; +# class Bar { +# public: namespace Ns { +# struct Foobar { class Bar { +# int a; public: +# int b; struct Foobar { +# }; int a; +# private: int b; +# int t; }; +# int method1() { +# // ... private: +# } int t; +# enum List { +# ITEM1, int method1() { +# ITEM2 // ... +# }; } +# template +# int method2(T x) { enum List { +# // ... ITEM1, +# } ITEM2 +# int i, j, k; }; +# int method3(int par) { +# // ... template +# } int method2(T x) { +# }; // ... +# class C {}; } +# } +# int i, j, k; +# +# int method3(int par) { +# // ... +# } +# }; +# +# class C {}; +# } +SeparateDefinitionBlocks: Always + +# true: false: +# int a = 5; vs. int a= 5; +# a += 42; a+= 42; +SpaceBeforeAssignmentOperators: true + +# Put a space before opening parentheses only after control statement keywords +# (for/if/while...). +# +# void f() { +# if (true) { +# f(); +# } +# } +SpaceBeforeParens: ControlStatements +SpacesBeforeTrailingComments: 1 + +# static_cast(arg); +# std::function fct; +SpacesInAngles: Never + +Standard: Auto + +# Macros which are ignored in front of a statement, as if they were an +# attribute. So that they are not parsed as identifier, for example for Qts +# emit. +# unsigned char data = 'x'; +# emit signal(data); // This is parsed as variable declaration. +# +# vs. +# +# unsigned char data = 'x'; +# emit signal(data); // Now it's fine again. +StatementAttributeLikeMacros: [emit] +--- diff --git a/feely_pona.cpp b/feely_pona.cpp index 1320717..f982728 100644 --- a/feely_pona.cpp +++ b/feely_pona.cpp @@ -7,13 +7,12 @@ Dqn_f32 const PHYSICS_STEP = 1 / 60.f; Dqn_Rect FP_Game_GetBuildingPlacementRectForEntity(FP_Game *game, FP_GamePlaceableBuilding placeable_building, FP_GameEntityHandle handle) { - Dqn_Rect result = {}; + Dqn_Rect result = {}; FP_GameEntity *entity = FP_Game_GetEntity(game, handle); if (FP_Game_IsNilEntity(entity)) return result; FP_EntityRenderData render_data = FP_Entity_GetRenderData(game, placeable_building.type, placeable_building.state, entity->direction); - Dqn_Rect box = FP_Game_CalcEntityWorldHitBox(game, entity->handle); Dqn_V2 build_p = {}; switch (entity->direction) { @@ -142,7 +141,7 @@ static void FP_Game_MoveEntity(FP_Game *game, FP_GameEntityHandle entity_handle, Dqn_f32 velocity_falloff_coefficient = 0.82f; Dqn_f32 acceleration_feel_good_factor = 15'000.f; - Dqn_V2 acceleration = FP_Game_MetersToPixelsV2(game->play, acceleration_meters_per_s) * acceleration_feel_good_factor; + Dqn_V2 acceleration = FP_Game_MetersToPixelsV2(game->play, acceleration_meters_per_s) * acceleration_feel_good_factor; entity->velocity = (acceleration * t) + entity->velocity * velocity_falloff_coefficient; // NOTE: Zero out velocity with epsilon @@ -151,17 +150,17 @@ static void FP_Game_MoveEntity(FP_Game *game, FP_GameEntityHandle entity_handle, if (DQN_ABS(entity->velocity.y) < 5.f) entity->velocity.y = 0.f; - Dqn_V2 delta_pos = (acceleration * 0.5f * t_squared) + (entity->velocity * t); + Dqn_V2 delta_pos = (acceleration * 0.5f * t_squared) + (entity->velocity * t); Dqn_Rect entity_world_hit_box = FP_Game_CalcEntityWorldHitBox(game, entity->handle); - Dqn_V2 entity_pos = FP_Game_CalcEntityWorldPos(game, entity->handle); - Dqn_V2 entity_new_pos = entity_pos + delta_pos; + Dqn_V2 entity_pos = FP_Game_CalcEntityWorldPos(game, entity->handle); + Dqn_V2 entity_new_pos = entity_pos + delta_pos; - Dqn_f32 const SENTINEL_T = 999.f; - Dqn_f32 global_earliest_t = SENTINEL_T; - Dqn_V2 global_earliest_pos_just_before_collide = {}; + Dqn_f32 const SENTINEL_T = 999.f; + Dqn_f32 global_earliest_t = SENTINEL_T; + Dqn_V2 global_earliest_pos_just_before_collide = {}; if ((entity->flags & FP_GameEntityFlag_NoClip) == 0) { - for (FP_GameEntityIterator collider_it = {}; FP_Game_DFSPostOrderWalkEntityTree(game, &collider_it, game->play.root_entity); ) { + for (FP_GameEntityIterator collider_it = {}; FP_Game_DFSPostOrderWalkEntityTree(game, &collider_it, game->play.root_entity);) { FP_GameEntity *collider = collider_it.entity; if (collider->handle == entity->handle) continue; @@ -3238,8 +3237,9 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer, TELY_Render_PushColourV4(renderer, TELY_COLOUR_WHITE_V4); Dqn_V4 bg_colour = TELY_Colour_V4Alpha(TELY_COLOUR_BLACK_V4, 0.8f); - if (game->play.state == FP_GameState_IntroScreen) + if (game->play.state == FP_GameState_IntroScreen) { bg_colour = TELY_Colour_V4InitRGBAU32(0x301010FF); + } TELY_Render_RectColourV4( renderer, diff --git a/project.rdbg b/project.rdbg index 95cd6f3..75dc760 100644 Binary files a/project.rdbg and b/project.rdbg differ