Initial project scaffold

Sets up eframe/egui app with basic menu bar and placeholder viewport. Adds Rhai scripting dependency for future game object scripting system.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 23:42:14 -05:00
commit f3e5dece7f
5 changed files with 4482 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
/target
.idea/
+30
View File
@@ -0,0 +1,30 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project
`viberogue` is a roguelike game written in Rust (edition 2024). It is in early development with no dependencies yet.
## Commands
```bash
cargo build # compile
cargo run # build and run
cargo test # run all tests
cargo test <name> # run a single test by name (substring match)
cargo clippy # lint
cargo fmt # format
```
## Architecture
The game is a single Rust binary using **eframe 0.33 / egui 0.33** for the GUI. eframe drives a retained-mode UI: the `App::update` method is called every frame and is responsible for both drawing and responding to input.
`update` is structured in two panels:
- `egui::TopBottomPanel::top` — menu bar (File → Exit)
- `egui::CentralPanel::default` — game viewport; use `ui.painter()` to draw directly
As the codebase grows, game state will live on the `App` struct and game logic will be split into modules under `src/` (map generation, entities, etc.). Keep game logic separate from the egui drawing calls in `update`.
eframe runs on its own event loop thread; do not assume single-threaded execution.
Generated
+4408
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "viberogue"
version = "0.1.0"
edition = "2024"
[dependencies]
eframe = "0.33.3"
rhai = "1"
+34
View File
@@ -0,0 +1,34 @@
use eframe::egui;
fn main() -> eframe::Result<()> {
let options = eframe::NativeOptions::default();
eframe::run_native(
"Viberogue",
options,
Box::new(|_cc| Ok(Box::new(App::default()))),
)
}
#[derive(Default)]
struct App;
impl eframe::App for App {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::TopBottomPanel::top("menu_bar").show(ctx, |ui| {
egui::MenuBar::new().ui(ui, |ui| {
ui.menu_button("File", |ui| {
if ui.button("Exit").clicked() {
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
}
});
});
});
egui::CentralPanel::default().show(ctx, |ui| {
let rect = ui.available_rect_before_wrap();
let center = rect.center();
let square = egui::Rect::from_center_size(center, egui::vec2(200.0, 200.0));
ui.painter().rect_filled(square, 0.0, egui::Color32::BLUE);
});
}
}