Initial Fyrox project

This commit is contained in:
Alexey 2025-07-08 17:43:03 +03:00
commit 27d327933e
23 changed files with 5633 additions and 0 deletions

12
game/Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "red_dragon_pon"
version = "0.1.0"
edition = "2021"
[dependencies]
fyrox = {workspace = true}
[features]
default = ["fyrox/default"]
dylib-engine = ["fyrox/dylib"]

69
game/src/lib.rs Normal file
View file

@ -0,0 +1,69 @@
//! Game project.
use fyrox::{
core::pool::Handle, core::visitor::prelude::*, core::reflect::prelude::*,
event::Event,
gui::message::UiMessage,
plugin::{Plugin, PluginContext, PluginRegistrationContext},
scene::Scene,
};
use std::path::Path;
// Re-export the engine.
pub use fyrox;
#[derive(Default, Visit, Reflect, Debug)]
pub struct Game {
scene: Handle<Scene>,
}
impl Plugin for Game {
fn register(&self, _context: PluginRegistrationContext) {
// Register your scripts here.
}
fn init(&mut self, scene_path: Option<&str>, context: PluginContext) {
context
.async_scene_loader
.request(scene_path.unwrap_or("data/scene.rgs"));
}
fn on_deinit(&mut self, _context: PluginContext) {
// Do a cleanup here.
}
fn update(&mut self, _context: &mut PluginContext) {
// Add your global update code here.
}
fn on_os_event(
&mut self,
_event: &Event<()>,
_context: PluginContext,
) {
// Do something on OS event here.
}
fn on_ui_message(
&mut self,
_context: &mut PluginContext,
_message: &UiMessage,
) {
// Handle UI events here.
}
fn on_scene_begin_loading(&mut self, _path: &Path, ctx: &mut PluginContext) {
if self.scene.is_some() {
ctx.scenes.remove(self.scene);
}
}
fn on_scene_loaded(
&mut self,
_path: &Path,
scene: Handle<Scene>,
_data: &[u8],
_context: &mut PluginContext,
) {
self.scene = scene;
}
}