BANG BIG PEANITS

This commit is contained in:
2026-07-25 16:50:55 +03:00
commit a2b00e5942
11 changed files with 592 additions and 0 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use nix

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/target
/.direnv/

347
Cargo.lock generated Normal file
View File

@@ -0,0 +1,347 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "aho-corasick"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
dependencies = [
"memchr",
]
[[package]]
name = "animal-rayscue"
version = "0.1.0"
dependencies = [
"raylib",
]
[[package]]
name = "bindgen"
version = "0.72.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
dependencies = [
"bitflags",
"cexpr",
"clang-sys",
"itertools",
"log",
"prettyplease",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex 1.3.0",
"syn 2.0.119",
]
[[package]]
name = "bitflags"
version = "2.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
[[package]]
name = "cc"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9"
dependencies = [
"find-msvc-tools",
"jobserver",
"libc",
"shlex 2.0.1",
]
[[package]]
name = "cexpr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
dependencies = [
"nom",
]
[[package]]
name = "cfg-if"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "clang-sys"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]]
name = "cmake"
version = "0.1.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"
dependencies = [
"cc",
]
[[package]]
name = "either"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d"
[[package]]
name = "find-msvc-tools"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
[[package]]
name = "getrandom"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
dependencies = [
"cfg-if",
"libc",
"r-efi",
]
[[package]]
name = "glob"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]]
name = "jobserver"
version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"
dependencies = [
"getrandom",
"libc",
]
[[package]]
name = "libc"
version = "0.2.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
[[package]]
name = "libloading"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
dependencies = [
"cfg-if",
"windows-link",
]
[[package]]
name = "log"
version = "0.4.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
[[package]]
name = "memchr"
version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]]
name = "prettyplease"
version = "0.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
dependencies = [
"proc-macro2",
"syn 2.0.119",
]
[[package]]
name = "proc-macro2"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
dependencies = [
"proc-macro2",
]
[[package]]
name = "r-efi"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
[[package]]
name = "raylib"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74b6057eb69bc6ac196260f5751a9bc69d69a445174d288ad87b9f6cefecd88c"
dependencies = [
"raylib-sys",
"seq-macro",
"thiserror",
]
[[package]]
name = "raylib-sys"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36be0f95d9ea818847eedf4a6a73cbd5331db5a558069747dae827ac3c12fdf8"
dependencies = [
"bindgen",
"cc",
"cmake",
]
[[package]]
name = "regex"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]]
name = "rustc-hash"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
[[package]]
name = "seq-macro"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "shlex"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "syn"
version = "2.0.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "thiserror"
version = "2.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "2.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd"
dependencies = [
"proc-macro2",
"quote",
"syn 3.0.3",
]
[[package]]
name = "unicode-ident"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
[[package]]
name = "windows-link"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"

8
Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "animal-rayscue"
version = "0.1.0"
edition = "2024"
[dependencies]
raylib = "6.0"

1
changelog.org Normal file
View File

@@ -0,0 +1 @@
* Unreleased

48
docs/entities.svg Normal file
View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.2.1 (0)
-->
<!-- Pages: 1 -->
<svg width="752pt" height="44pt"
viewBox="0.00 0.00 751.67 44.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 40)">
<polygon fill="white" stroke="none" points="-4,4 -4,-40 747.67,-40 747.67,4 -4,4"/>
<!-- player -->
<g id="node1" class="node">
<title>player</title>
<ellipse fill="none" stroke="black" cx="42.79" cy="-18" rx="42.79" ry="18"/>
<text text-anchor="middle" x="42.79" y="-13.32" font-family="Times,serif" font-size="14.00">player</text>
</g>
<!-- animal -->
<g id="node2" class="node">
<title>animal</title>
<ellipse fill="none" stroke="black" cx="148.79" cy="-18" rx="44.89" ry="18"/>
<text text-anchor="middle" x="148.79" y="-13.32" font-family="Times,serif" font-size="14.00">animal</text>
</g>
<!-- save_animal -->
<g id="node3" class="node">
<title>save_animal</title>
<polygon fill="none" stroke="black" points="314.29,-36 211.29,-36 211.29,0 314.29,0 314.29,-36"/>
<text text-anchor="middle" x="262.79" y="-13.32" font-family="Times,serif" font-size="14.00">save_animal</text>
</g>
<!-- interact_with_env -->
<g id="node4" class="node">
<title>interact_with_env</title>
<polygon fill="none" stroke="black" points="475.17,-36 332.42,-36 332.42,0 475.17,0 475.17,-36"/>
<text text-anchor="middle" x="403.79" y="-13.32" font-family="Times,serif" font-size="14.00">interact_with_env</text>
</g>
<!-- interact_with_anim -->
<g id="node5" class="node">
<title>interact_with_anim</title>
<polygon fill="none" stroke="black" points="646.04,-36 493.54,-36 493.54,0 646.04,0 646.04,-36"/>
<text text-anchor="middle" x="569.79" y="-13.32" font-family="Times,serif" font-size="14.00">interact_with_anim</text>
</g>
<!-- use_item -->
<g id="node6" class="node">
<title>use_item</title>
<polygon fill="none" stroke="black" points="743.67,-36 663.92,-36 663.92,0 743.67,0 743.67,-36"/>
<text text-anchor="middle" x="703.79" y="-13.32" font-family="Times,serif" font-size="14.00">use_item</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

24
notes.org Normal file
View File

@@ -0,0 +1,24 @@
* Inbox
** [2026-07-25 Sat 14:06] Level Design
- player (helps animal)
- save animal (and bring it back)
- Stage changes after saving animal to get back
** Diagrams
#+begin_src dot :file docs/entities.svg :results file graphics
digraph {
//entities
player;
animal;
// actions
node [shape="box"];
save_animal;
interact_with_env;
interact_with_anim;
use_item;
escape_player;
}
#+end_src
#+RESULTS:
[[file:docs/entities.svg]]

37
shell.nix Normal file
View File

@@ -0,0 +1,37 @@
{ pkgs ? import <nixpkgs> {} }:
let
libs = with pkgs; [
libGL
libx11
libxcursor
libxrandr
libxinerama
libxi
libxext
wayland
libxkbcommon
alsa-lib
fontconfig
freetype
glfw
curl
];
in
pkgs.mkShell {
buildInputs = with pkgs; [
rustup
cmake
pkg-config
gcc
llvmPackages.libclang
llvmPackages.clang
] ++ libs;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (libs ++ [ pkgs.llvmPackages.libclang.lib ]);
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${pkgs.glibc.dev}/include -isystem ${pkgs.stdenv.cc.cc}/lib/gcc/${pkgs.stdenv.hostPlatform.config}/${pkgs.stdenv.cc.cc.version}/include";
}

17
src/controls.rs Normal file
View File

@@ -0,0 +1,17 @@
pub struct InputState {
pub right: bool,
pub left: bool,
pub down: bool,
pub jump: bool,
}
impl InputState {
pub fn new(right: bool, left: bool, down: bool, jump: bool) -> Self {
Self {
right,
left,
down,
jump,
}
}
}

53
src/main.rs Normal file
View File

@@ -0,0 +1,53 @@
use controls::InputState;
use player::Player;
mod controls;
mod player;
fn main() {
use raylib::prelude::*;
let (mut rl, thread) = raylib::init().size(640, 480).title("My peanits").build();
let mut player: Player = Player::default();
while !rl.window_should_close() {
rl.set_target_fps(69);
// Player movement
if rl.is_key_down(KeyboardKey::KEY_RIGHT) {
player.handle_input(&InputState::new(true, false, false, false));
println!("LEFT");
} else if rl.is_key_down(KeyboardKey::KEY_LEFT) {
player.handle_input(&InputState::new(false, true, false, false));
} else if rl.is_key_down(KeyboardKey::KEY_DOWN) {
player.handle_input(&InputState::new(false, false, true, false));
} else if rl.is_key_down(KeyboardKey::KEY_SPACE) {
player.handle_jump(&InputState::new(false, false, false, true));
}
let mut d = rl.begin_drawing(&thread);
d.clear_background(Color::WHITE);
d.draw_text("MY BIG PEANITS", 12, 12, 20, Color::BLACK);
d.draw_rectangle(
player.position.x as i32,
player.position.y as i32,
100,
200,
Color::RED,
);
d.draw_circle(
(player.position.x + 50.0) as i32,
player.position.y as i32,
50.0,
Color::RED,
);
d.draw_circle(
(player.position.x + 100.0) as i32,
(player.position.y + 210.0) as i32,
50.0,
Color::RED,
);
d.draw_circle(
(player.position.x + 15.0) as i32,
(player.position.y + 210.0) as i32,
50.0,
Color::RED,
);
}
}

54
src/player.rs Normal file
View File

@@ -0,0 +1,54 @@
use super::controls::InputState;
use raylib::prelude::*;
#[derive(Default)]
pub struct Player {
pub position: Vector2,
width: f32,
height: f32,
speed: f32,
jump_velocity: f32,
grounded: bool,
}
impl Player {
fn new(
position: Vector2,
width: f32,
height: f32,
speed: f32,
jump_velocity: f32,
grounded: bool,
) -> Self {
Self {
position,
width,
height,
speed,
jump_velocity,
grounded,
}
}
pub fn handle_input(&mut self, input: &InputState) {
// Da inpoot handol))
if input.right {
self.position.x += 2.0;
} else if input.left {
self.position.x -= 2.0;
} else if input.down {
self.position.y += 4.0;
}
}
pub fn handle_jump(&mut self, input: &InputState) {
if input.jump {
self.position.y -= 10.0;
}
}
pub fn rect(&self) -> Rectangle {
todo!()
// Collision bawx n shi
}
}