-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Moved presets to src/configs.h * Created common.h * Added color palettes * Fixed with up/down scrolling in menus ( wrapping around from the top would not work properly ) * Changed force refresh rate to every 128 frames ( previously 16 ) * Fixed custom config default fill rate to 50% ( previously 30% ) * Modified README.md * Changed optimization level to 2 (previously size)
- Loading branch information
1 parent
d0ff451
commit b48376d
Showing
6 changed files
with
194 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef COMMON_H | ||
#define COMMON_H | ||
|
||
#include <eadk.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
// Modulus so that (-1)%7 = 5 | ||
#define MOD(a,b) ((((a)%(b))+(b))%(b)) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#ifndef CONFIGS_H | ||
#define CONFIGS_H | ||
|
||
#include "common.h" | ||
#include "palettes.h" | ||
|
||
typedef struct config { | ||
float F; // How much should the grid be filled when initializing | ||
uint16_t B; // Birth rule | ||
uint16_t S; // Survival rule | ||
uint8_t s; // (WIP) State count | ||
const char* name; // The name of the rule / configuration | ||
pal_t* palette; // The color palette of the rule | ||
} config_t; | ||
|
||
static const char* const menu_custom_name = "[Custom]"; | ||
static const char* const menu_config_name = "[Configure]"; | ||
|
||
#define NCONFIGS ((sizeof(configs)/sizeof(config_t))-1) | ||
|
||
config_t configs[] = { // All of the preset configurations | ||
{ .F = .50f, | ||
.B = 0b000001000, | ||
.S = 0b000001100, | ||
.s = 2, | ||
.name = menu_custom_name, | ||
.palette = &pal_custom, | ||
}, | ||
{ .name = menu_config_name, }, | ||
{ .F = .50f, | ||
.B = 0b000001000, | ||
.S = 0b000001100, | ||
.s = 2, | ||
.name = "GOL", | ||
.palette = &pal_default, | ||
}, | ||
{ .F = .75f, | ||
.B = 0b000001000, | ||
.S = 0b000111110, | ||
.s = 2, | ||
.name = "Maze", | ||
.palette = &pal_default, | ||
}, | ||
{ .F = .75f, | ||
.B = 0b110001000, | ||
.S = 0b111101100, | ||
.s = 2, | ||
.name = "Coagulation", | ||
.palette = &pal_default, | ||
}, | ||
{ .F = .50f, | ||
.B = 0b010001000, | ||
.S = 0b100111000, | ||
.s = 3, | ||
.name = "Cool", | ||
.palette = &pal_cool, | ||
}, | ||
{ .F = .10f, | ||
.B = 0b000000100, | ||
.S = 0b000010100, | ||
.s = 8, | ||
.name = "Crystal", | ||
.palette = &pal_crystal, | ||
}, | ||
{ .F = .10f, | ||
.B = 0b000101010, | ||
.S = 0b110111100, | ||
.s = 2, | ||
.name = "Land Rush", | ||
.palette = &pal_default, | ||
}, | ||
{ 0 } | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.