-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'SkyUOI:main' into main
- Loading branch information
Showing
42 changed files
with
672 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
cargo-features = ["edition2024", "profile-rustflags"] | ||
[package] | ||
name = "gdrust" | ||
version = "0.1.0" | ||
edition = "2021" | ||
edition = "2024" | ||
|
||
[dependencies] | ||
godot = { git = "https://github.com/godot-rust/gdext", branch = "master" } | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[profile.release] | ||
lto = true | ||
codegen-units = 1 | ||
strip = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod star_wrath_bullet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use godot::engine::{Area2D, IArea2D}; | ||
use godot::obj::WithBaseField; | ||
use godot::prelude::*; | ||
|
||
#[derive(GodotClass)] | ||
#[class(base=Area2D)] | ||
struct StarWrathBullet { | ||
base: Base<Area2D>, | ||
direct: Vector2, | ||
} | ||
|
||
const INIT_DIRECT: Vector2 = Vector2::new(0.0, 0.0); | ||
|
||
#[godot_api()] | ||
impl IArea2D for StarWrathBullet { | ||
fn init(base: Base<Area2D>) -> Self { | ||
Self { | ||
base, | ||
direct: INIT_DIRECT, | ||
} | ||
} | ||
|
||
fn process(&mut self, delta: f64) { | ||
let tmp = self.base().get_position() + self.direct.normalized() * delta as f32; | ||
self.base_mut().set_position(tmp); | ||
} | ||
} | ||
|
||
#[godot_api()] | ||
impl StarWrathBullet { | ||
fn init() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
mod block; | ||
mod bar; | ||
mod block_drawer; | ||
mod health_bar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use godot::engine::{Control, IControl}; | ||
use godot::prelude::*; | ||
|
||
#[derive(GodotClass)] | ||
#[class(base=Control)] | ||
struct Bar { | ||
base: Base<Control>, | ||
} | ||
|
||
#[godot_api()] | ||
impl IControl for Bar { | ||
fn init(base: Base<Control>) -> Self { | ||
Self { base } | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
use godot::engine::{Area2D, CollisionPolygon2D, INode2D, Node2D}; | ||
use godot::obj::WithBaseField; | ||
use godot::prelude::*; | ||
|
||
#[derive(GodotClass)] | ||
#[class(base = Node2D)] | ||
struct BlockDrawer { | ||
base: Base<Node2D>, | ||
#[var] | ||
x: f32, | ||
#[var] | ||
y: f32, | ||
} | ||
|
||
const BLOCK_COLOR: Color = Color::from_rgb(10.0, 10.0, 10.0); | ||
const WIDTH: f32 = 12.0; | ||
|
||
#[godot_api] | ||
impl INode2D for BlockDrawer { | ||
fn init(base: Base<Node2D>) -> BlockDrawer { | ||
// godot_print!("BlockDrawer created from Godot Rust"); | ||
Self { | ||
x: Self::BOX_START_POS_X, | ||
y: Self::BOX_START_POS_Y, | ||
base, | ||
} | ||
} | ||
|
||
fn ready(&mut self) { | ||
let mut collision_obj = self | ||
.base_mut() | ||
.get_node_as::<CollisionPolygon2D>("collision/collision"); | ||
let mut points = PackedVector2Array::new(); | ||
points.push(Vector2::new(self.x, self.y)); | ||
points.push(Vector2::new(self.get_opposite_x(), self.y)); | ||
points.push(Vector2::new( | ||
self.get_opposite_x(), | ||
self.y + Self::Y_SIZE_DEFAULT, | ||
)); | ||
points.push(Vector2::new(self.x, self.y + Self::Y_SIZE_DEFAULT)); | ||
collision_obj.set_polygon(points); | ||
collision_obj.set_disabled(false); | ||
} | ||
|
||
fn process(&mut self, delta: f64) {} | ||
|
||
fn draw(&mut self) { | ||
let xsize = self.get_opposite_x(); | ||
|
||
godot_print!("enter"); | ||
let tmp = Vector2::new(self.x, self.y); | ||
self.base_mut() | ||
.draw_rect_ex( | ||
Rect2::new(tmp, Vector2::new(xsize, Self::Y_SIZE_DEFAULT)), | ||
BLOCK_COLOR, | ||
) | ||
.width(WIDTH) | ||
.filled(false) | ||
.done(); | ||
} | ||
} | ||
|
||
impl BlockDrawer { | ||
fn get_opposite_x(&self) -> f32 { | ||
let tmp = self.x; | ||
let xsize = self.base().get_viewport_rect().size.x - tmp * 2.0; | ||
xsize | ||
} | ||
} | ||
|
||
#[godot_api] | ||
impl BlockDrawer { | ||
const BOX_START_POS_X: f32 = 400.0; | ||
const BOX_START_POS_Y: f32 = 300.0; | ||
const Y_SIZE_DEFAULT: f32 = 200.0; | ||
|
||
#[func] | ||
fn change_block_immediate(&mut self, x: f32, y: f32) { | ||
self.x = x; | ||
self.y = y; | ||
} | ||
|
||
#[func] | ||
fn change_block_gently(&mut self, x: i32, y: i32) {} | ||
|
||
#[func] | ||
fn get_y_min(&mut self) -> i32 { | ||
// self.base(). | ||
(self.base().get_viewport_rect().size.y - self.y) as i32 | ||
} | ||
|
||
#[func] | ||
fn get_x_min(&mut self) -> i32 { | ||
// self.base(). | ||
(self.base().get_viewport_rect().size.x - self.x) as i32 | ||
} | ||
|
||
#[func] | ||
fn collision_signal(&mut self, obj: Gd<Area2D>) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use godot::engine::{INode2D, Node2D}; | ||
use godot::prelude::*; | ||
|
||
#[derive(GodotClass)] | ||
#[class(base=Node2D)] | ||
struct HealthBar { | ||
base: Base<Node2D>, | ||
} | ||
|
||
#[godot_api()] | ||
impl INode2D for HealthBar { | ||
fn init(base: Base<Node2D>) -> Self { | ||
Self { base } | ||
} | ||
|
||
fn draw(&mut self) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
mod bullets; | ||
mod fight_items; | ||
mod player; | ||
mod weapons; | ||
mod zenith; | ||
|
||
use godot::prelude::*; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod star_wrath; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use godot::engine::{Area2D, IArea2D}; | ||
use godot::obj::WithBaseField; | ||
use godot::prelude::*; | ||
|
||
#[derive(GodotClass)] | ||
#[class(base=Area2D)] | ||
struct StarWrath { | ||
base: Base<Area2D>, | ||
} | ||
|
||
#[godot_api()] | ||
impl IArea2D for StarWrath { | ||
fn init(base: Base<Area2D>) -> Self { | ||
Self { base } | ||
} | ||
|
||
fn process(&mut self, delta: f64) {} | ||
} | ||
|
||
#[godot_api()] | ||
impl StarWrath { | ||
fn init() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use godot::engine::{Area2D, IArea2D}; | ||
use godot::prelude::*; | ||
|
||
#[derive(GodotClass)] | ||
#[class(base = Area2D)] | ||
struct ZenithBegin { | ||
base: Base<Area2D>, | ||
} | ||
|
||
#[godot_api()] | ||
impl IArea2D for ZenithBegin { | ||
fn init(base: Base<Area2D>) -> ZenithBegin { | ||
ZenithBegin { base } | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.