omakase/data.jai

38 lines
834 B
Plaintext

State :: struct {
idTicker : int = 0;
recipes : [..]Recipe;
};
get_id :: () -> string {
state.idTicker += 1;
return sprint("REF-%", state.idTicker);
}
Component :: struct {
}
Recipe :: struct {
id : string;
name : string = "New recipe!";
category : string = "Breakfast";
image : string = "https://images.unsplash.com/photo-1546069901-ba9599a7e63c?q=80&w=500&auto=format&fit=crop";
duration : int = 5;
}
state : State;
init_data :: () {
recipe := Recipe.{};
recipe.id = get_id();
array_add(*state.recipes, recipe);
recipe.id = get_id();
array_add(*state.recipes, recipe);
recipe.id = get_id();
array_add(*state.recipes, recipe);
recipe.id = get_id();
array_add(*state.recipes, recipe);
recipe.id = get_id();
array_add(*state.recipes, recipe);
}