From 66c9b10264b9cf4320ce17758ae44a2bbf57ce97 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Sun, 6 Oct 2024 00:57:24 +0200 Subject: [PATCH] sketch future file structure --- README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/editor.rs | 4 ++-- src/main.rs | 4 ++-- 3 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..24d8313 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# marble machinations +(working title) + +logic mostly like https://git.crispypin.cc/CrispyPin/marble + +file hierarchy +``` +- assets/ +- storage/ + - levels/ + - 00_zeroes.json + - 01_cat.json + - 02_parse.json + - 99_sandbox.json + - solutions/ + - 00_zeroes/ + - solution_0.json + - solution_1.json + - factorial_194726/ + - solution_0.json + - solution_1.json + - blueprints + - blueprint_0.json + - custom_levels/ + - factorial_194726.json +``` + +`00_zeroes.json` +```json +{ + "id": "00_zeroes", + "name": "Zeroes", + "description": "learn how to output data", + "init_board": null, + "inputs": [], + "outputs": [0, 0, 0, 0, 0, 0, 0, 0] +} +``` +`00_zeroes/solution_0.json` +```json +{ + "level_id": "00_zeroes", //redundant, useful if sharing solution files? + "name": "unnamed 1", + "board": "oo\nP*\n|-" +} +``` + +`blueprints/blueprint_0.json` +```json +{ + "name": "fast printer", + "board": "oo\nP*\n|-" +} +``` \ No newline at end of file diff --git a/src/editor.rs b/src/editor.rs index 158721e..b30b98d 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -12,7 +12,7 @@ use crate::{ }; #[derive(Debug)] -pub struct Game { +pub struct Editor { source_board: Board, machine: Machine, sim_state: SimState, @@ -51,7 +51,7 @@ enum SimState { Stepping, } -impl Game { +impl Editor { pub fn new_sandbox() -> Self { Self { source_board: Board::new_empty(16, 16), diff --git a/src/main.rs b/src/main.rs index c9a5448..78ef78f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use std::fs::read_to_string; -use editor::Game; +use editor::Editor; use marble_engine::board::Board; use raylib::prelude::*; @@ -24,7 +24,7 @@ fn main() { textures.load_dir("assets", &mut rl, &thread); textures.load_dir("assets/tiles", &mut rl, &thread); - let mut game = Game::new_sandbox(); + let mut game = Editor::new_sandbox(); let board = Board::parse(&read_to_string("boards/adder.mbl").unwrap()); game.load_board(board);