This commit is contained in:
2024-02-29 19:02:21 -05:00
commit c063534571
16 changed files with 4210 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/target

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/test-game.iml" filepath="$PROJECT_DIR$/.idea/test-game.iml" />
</modules>
</component>
</project>

11
.idea/test-game.iml generated Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

3
.vs/ProjectSettings.json Normal file
View File

@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}

View File

@@ -0,0 +1,9 @@
{
"ExpandedNodes": [
"",
"\\.idea",
"\\src"
],
"SelectedNode": "\\Cargo.toml",
"PreviewInSolutionExplorer": false
}

BIN
.vs/slnx.sqlite Normal file

Binary file not shown.

BIN
.vs/test-game/v17/.wsuo Normal file

Binary file not shown.

View File

@@ -0,0 +1,63 @@
{
"Version": 1,
"WorkspaceRootPath": "D:\\GitHub\\test-game\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\GitHub\\test-game\\src\\main.rs||{8B382828-6202-11D1-8870-0000F87579D2}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:src\\main.rs||{8B382828-6202-11D1-8870-0000F87579D2}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 312,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{e506b91c-c606-466a-90a9-123d1d1e12b3}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "main.rs",
"DocumentMoniker": "D:\\GitHub\\test-game\\src\\main.rs",
"RelativeDocumentMoniker": "src\\main.rs",
"ToolTip": "D:\\GitHub\\test-game\\src\\main.rs",
"RelativeToolTip": "src\\main.rs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAwAAAABAAAA",
"Icon": "cb4a8fc6-efe7-424a-b611-23adf22b568e.000030|",
"WhenOpened": "2024-02-29T14:44:30.261Z",
"EditorCaption": ""
}
]
},
{
"DockedWidth": 316,
"SelectedChildIndex": -1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{e1b7d1f8-9b3c-49b1-8f4f-bfc63a88835d}"
},
{
"$type": "Bookmark",
"Name": "ST:129:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
},
{
"$type": "Bookmark",
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
}
]
}
]
}
]
}

4042
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

9
Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "test-game"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = "0.13.0"

1
rustfmt.toml Normal file
View File

@@ -0,0 +1 @@
hard_tabs=true

43
src/boids.rs Normal file
View File

@@ -0,0 +1,43 @@
use bevy::prelude::*;
pub struct Boids;
impl Plugin for Boids {
fn build(&self, app: &mut App) {
app.insert_resource(PrintTimer(Timer::from_seconds(2.0, TimerMode::Repeating)))
.add_systems(Startup, add_boids)
.add_systems(Update, (update_boid, print_boid).chain());
}
}
fn print_boid(time: Res<Time>, mut timer: ResMut<PrintTimer>, query: Query<&Name, With<Boid>>) {
if !timer.0.tick(time.delta()).just_finished() {
return;
}
for name in &query {
println!("{}", name.0);
}
}
fn update_boid(mut query: Query<&mut Name, With<Boid>>) {
for mut name in &mut query {
if name.0 == "B1" {
name.0 = "B1.Updated".to_string();
break;
}
}
}
fn add_boids(mut commands: Commands) {
commands.spawn((Boid, Name("B1".to_string())));
commands.spawn((Boid, Name("B2".to_string())));
commands.spawn((Boid, Name("B3".to_string())));
}
#[derive(Resource)]
struct PrintTimer(Timer);
#[derive(Component)]
struct Boid;
#[derive(Component)]
struct Name(String);

6
src/main.rs Normal file
View File

@@ -0,0 +1,6 @@
use bevy::prelude::*;
mod boids;
fn main() {
App::new().add_plugins((DefaultPlugins, boids::Boids)).run();
}