Skip to content

Latest commit

 

History

History
162 lines (122 loc) · 2.01 KB

QUESTIONS.md

File metadata and controls

162 lines (122 loc) · 2.01 KB

Code convention

Include syntax ?

#include <stdbool.h>
#include "eng_stdbool.h"

Memory leak monitor ?

Bool VS Int ?

int enabled = 1;
if(enabled == 1) {
    printf("Is Enabled!");
}
#include <stdbool.h>

bool enabled = true;
if(enabled == true) {
    printf("Is Enabled!");
}

Structure instanciation ?

Vector3 vec = (Vector3){
    0.0f,
    1.0f,
    -1.0f};
Vector3 vec = {0};
vec.x = 0.0f;
vec.y = 1.0f;
vec.z = -1.0f;

Structure declaration ?

typedef struct MyObject MyObject;
struct MyObject
{
    int number;
};
typedef struct MyObject
{
    int number;
} MyObject;

CMake vars case ?

set(game "../../game")

include_directories(
  ${game}/src
)
set(game "../../game")

include_directories(
  ${game}/src
)

Properties visibily naming ?

struct MyComp_State
{
    int counter;
};

struct MyComp_Props
{
    int increment;
};
MyComp_State Init(MyComp_Props props);

void UpdateMyComp(MyComp_State state, MyComp_Props props);

void RenderComp(MyComp_State state, MyComp_Props props);
MyComp_Private Init(MyComp_Props public);

void UpdateMyComp(MyComp_Private private, MyComp_Props public);

void RenderComp(MyComp_Private private, MyComp_Props public);

Mixing pointers and value ?

Launcher_State InitLauncher();

int UpdateLauncher(Launcher_State *state); // read/write function

void DrawLauncher(Launcher_State *state); // read only
Launcher_State InitLauncher();

int UpdateLauncher(Launcher_State *state); // read/write function

void DrawLauncher(Launcher_State state); // read only

Property Case ?

// Camelcase
struct LauncherState
{
    Texture2D texture;
    int durationInMs;
    clock_t clockAtStartup;
};
// Snskecase
struct LauncherState
{
    Texture2D texture;
    int duration_in_ms;
    clock_t clock_at_startup;
};
struct LauncherState
{
    Texture2D texture;
    int durationinms;
    clock_t clockatstartup;
};