- C 99.2%
- C++ 0.4%
- Makefile 0.3%
- GLSL 0.1%
| ada_test | ||
| assets | ||
| include | ||
| src | ||
| story | ||
| .gitignore | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
Ada
Newest Update
- syntax for frame
TODO Stack
-
add test that entring state will reset option pointer
-
how to check float and double equality?
-
replace ASSERT_EQI in vm_test to ASSERT_EQD(); because Value is double
-
center the text in 2048
-
pass board as argument, don't use global variable
-
add shape_stroke_rect(), shape_stroke_rect_at()
-
make two types of font? one with fixed black color and other dynamic? for performance
-
create t_renderer_set_color() and remove color parameter in t_renderer_draw()
-
clean up new shader file for font
-
add new listing test: switching list
-
commit
-
test module shape asap
-
implement run-length encoding for line numbers
-
add OP_CONSTANT_LONG
-
two types of button? text and texture
-
refactor the input for testing to another module.
-
move stb_image.h outside src
Future Big Plan
- Create (rewrite) adascript using TDD.
- Build Ada's garden.
- Build Ada's farm.
- Build in-game shadertoy.
- Build in-game pixel editor.
- Build in-game level editor.
- Do genuary 2025 in Ada's Study Room.
- Port The Nature of Code examples in Ada's Study Room.
- Make program to scan all
TODO:in project source code. - Build LAda (Little Ada, subset of Ada programming language) interpreter for in-game use.
- Make Ada's github account.
About
This is a combination of game, visual novel, simulation, and mathematics study.
Compiling
You need Make and GCC. Navigate to project root and execute
make
The executable is ada in project root. To play run
./ada
Game Center
This is a collection of simple games.
Slide puzzle
Status: broken.
2048
Status: broken.
Design
- Don't track cursor position.
- Only get cursor position when mouse clicked.
- Write TODO as the last part in a comment.
Adascript Design
This is a modification from Crafting Interpreters Appendix 1. Removing Class
program : declaration* EOF ;
declaration : funDecl | varDecl | statement ;
funcDecl : "fn" function ; varDecl : "var" IDENTIFIER ( "=" expression )? ";" ;
statement : exprStmt | forStmt | ifStmt | printStmt | returnStmt | whileStmt | block ;
exprStmt : expression ";" ; forStmt : "for" "(" ( varDecl | exprStmt | ";" ) expression? ";" expression? ")" statement ; ifStmt : "if" "(" expression ")" statement ( "else" statement )? ; printStmt : "print" expression ";" ; returnStmt : "return" expression? ";" ; whileStmt : "while" "(" expression ")" statement ; block : "{" declaration* "}" ;
expression : assignment ; assignment : IDENTIFIER "=" assignment | logic_or ;
logic_or : logic_and ( "or" logic_and )* ; logic_and : equality ( "and" equality )* ; equality : comparison ( ( "!=" | "==" ) comparison )* ; comparison : term ( ( ">" | ">=" | "<" | "<=" ) term )* ; term : factor ( ( "-" | "+" ) factor )* ; factor : unary ( ( "/" | "" ) unary ) ; unary : ( "!" | "-" ) unary | call ; call : primary "(" arguments? ")" ; primary : "true" | "false" | "nil" | NUMBER | STRING | IDENTIFIER | "(" expression ")" ;
function : IDENTIFIER "(" parameters? ")" block ; parameters : IDENTIFIER ( "," IDENTIFIER )* ; arguements : expression ( "," expression )* ;
NUMBER : DIGIT+ ( "." DIGIT+ )? ; STRING : """ <any character except """>* """ ; IDENTIFIER : ALPHA ( ALPHA | DIGIT )* ; ALPHA : "a" ... "z" | "A" ... "Z" | "-" ; DIGIT : "0" ... "9" ;
Game Testing
What to test?
- No way to procedurally test visuals. So we won't test any render function.
- Test only init and update functions, for now.
- We programmatically click mouse, press key, move cursor, and resize window.
How to test module m?
-
Create m_test/ dir inside src/.
-
Create m_test.c, include game.h, m.h, and another deps.
-
Create m_test_run() in m_test.c where we run all test suite and then report.
-
Create helpers key_press() and key_release() to simulate pressing (releasing) key.
-
Copy main.c and game.c to m_test/ dir.
-
Remove unnecesary stuff in game_init() in game.c.
-
Add
glfwWindowHint( GLFW_VISIBLE, GLFW_FALSE )to hide the window. We don't need window. -
Remove game loop from main.c and forward declare m_test_run() from m_test.c
-
Call m_test_run() in main().
-
Create new Makefile and manually write necessary stuff for linking with our new main.c and game.c.
-
Since each module testing has different pattern, we better hard code the Makefile.
-
Place the executable in project root because of relative path.
License
MIT.