setup native script

This commit is contained in:
zoe 2022-05-01 19:47:50 +02:00
parent b0a9525111
commit c8046a6e85
9 changed files with 44 additions and 4 deletions

View File

@ -1,3 +1,3 @@
source_md5="45ad47a7538fbbd90a050327a8ade59d"
dest_md5="3fb74a6e43f8910b40ad19fd95e401a5"
source_md5="72b25c45d4743c578ac08e56b209be81"
dest_md5="73042650bec74eec84c50b98d4bafc70"

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -0,0 +1,10 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[sub_resource type="GDNativeLibrary" id=1]
entry/X11.64 = "res://native/libroutes_native.so"
dependency/X11.64 = [ ]
[resource]
resource_name = "StateServer"
class_name = "StateServer"
library = SubResource( 1 )

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://world/terrain/terrain.tres" type="TileSet" id=1]
[ext_resource path="res://world/terrain.gd" type="Script" id=2]
[ext_resource path="res://world/worldcam.gd" type="Script" id=3]
[ext_resource path="res://world/state_server.gdns" type="Script" id=4]
[node name="World" type="Node2D"]
@ -11,8 +12,8 @@ position = Vector2( -2, 0 )
mode = 1
tile_set = ExtResource( 1 )
cell_size = Vector2( 32, 16 )
centered_textures = true
format = 1
tile_data = PoolIntArray( -327689, 1, 65537, -327688, 1, 65537, -327687, 1, 65537, -327686, 1, 65537, -327685, 1, 65537, -327684, 1, 65537, -327683, 1, 65537, -327682, 1, 65537, -327681, 1, 65537, -393216, 1, 65537, -393215, 1, 65537, -393214, 1, 65537, -393213, 1, 65537, -393212, 1, 65537, -393211, 1, 65537, -393210, 1, 65537, -393209, 1, 65537, -393208, 1, 65537, -262153, 1, 65537, -262152, 1, 65537, -262151, 1, 65537, -262150, 1, 65537, -262149, 1, 65537, -262148, 1, 65537, -262147, 1, 65537, -262146, 1, 65537, -262145, 1, 65537, -327680, 1, 65537, -327679, 1, 65537, -327678, 1, 65537, -327677, 1, 65537, -327676, 1, 65537, -327675, 1, 65537, -327674, 1, 65537, -327673, 1, 65537, -327672, 1, 65537, -196617, 1, 65537, -196616, 1, 65537, -196615, 1, 65537, -196614, 1, 65537, -196613, 1, 65537, -196612, 1, 65537, -196611, 1, 65537, -196610, 1, 65537, -196609, 1, 65537, -262144, 1, 65537, -262143, 1, 65537, -262142, 1, 65537, -262141, 1, 65537, -262140, 1, 65537, -262139, 1, 65537, -262138, 1, 65537, -262137, 1, 65537, -262136, 1, 65537, -131081, 1, 65537, -131080, 1, 65537, -131079, 1, 65537, -131078, 1, 65537, -131077, 1, 65537, -131076, 1, 65537, -131075, 1, 65537, -131074, 1, 196608, -131073, 1, 196608, -196608, 1, 196608, -196607, 1, 65537, -196606, 1, 65537, -196605, 1, 65537, -196604, 1, 65537, -196603, 1, 65537, -196602, 1, 65537, -196601, 1, 65537, -196600, 1, 65537, -65545, 1, 65537, -65544, 1, 65537, -65543, 1, 65537, -65542, 1, 65537, -65541, 1, 65537, -65540, 1, 65537, -65539, 1, 196608, -65538, 1, 196608, -65537, 1, 196608, -131072, 1, 196608, -131071, 1, 196608, -131070, 1, 196608, -131069, 1, 65537, -131068, 1, 65537, -131067, 1, 65537, -131066, 1, 65537, -131065, 1, 65537, -131064, 1, 65537, -9, 1, 65537, -8, 1, 65537, -7, 1, 65537, -6, 1, 65537, -5, 1, 65537, -4, 1, 65537, -3, 1, 196608, -2, 1, 196608, -1, 1, 196608, -65536, 1, 196608, -65535, 1, 196608, -65534, 1, 196608, -65533, 1, 196608, -65532, 1, 196608, -65531, 1, 65537, -65530, 1, 65537, -65529, 1, 65537, -65528, 1, 65537, 65527, 1, 65537, 65528, 1, 65537, 65529, 1, 65537, 65530, 1, 65537, 65531, 1, 65537, 65532, 1, 65537, 65533, 1, 196608, 65534, 1, 196608, 65535, 1, 196608, 0, 1, 196608, 1, 1, 196608, 2, 1, 196608, 3, 1, 196608, 4, 1, 196608, 5, 1, 196608, 6, 1, 65537, 7, 1, 65537, 8, 1, 65537, 131063, 1, 65537, 131064, 1, 65537, 131065, 1, 65537, 131066, 1, 65537, 131067, 1, 65537, 131068, 1, 65537, 131069, 1, 65537, 131070, 1, 196608, 131071, 1, 196608, 65536, 1, 196608, 65537, 1, 196608, 65538, 1, 196608, 65539, 1, 196608, 65540, 1, 196608, 65541, 1, 196608, 65542, 1, 196608, 65543, 1, 65537, 65544, 1, 65537, 196599, 1, 65537, 196600, 1, 65537, 196601, 1, 65537, 196602, 1, 65537, 196603, 1, 65537, 196604, 1, 65537, 196605, 1, 65537, 196606, 1, 65537, 196607, 1, 196608, 131072, 1, 196608, 131073, 1, 196608, 131074, 1, 196608, 131075, 1, 196608, 131076, 1, 196608, 131077, 1, 196608, 131078, 1, 196608, 131079, 1, 65537, 131080, 1, 65537, 262135, 1, 65537, 262136, 1, 65537, 262137, 1, 65537, 262138, 1, 65537, 262139, 1, 65537, 262140, 1, 65537, 262141, 1, 65537, 262142, 1, 65537, 262143, 1, 65537, 196608, 1, 65537, 196609, 1, 196608, 196610, 1, 196608, 196611, 1, 196608, 196612, 1, 65537, 196613, 1, 196608, 196614, 1, 196608, 196615, 1, 65537, 196616, 1, 65537, 327671, 1, 65537, 327672, 1, 65537, 327673, 1, 65537, 327674, 1, 65537, 327675, 1, 65537, 327676, 1, 65537, 327677, 1, 65537, 327678, 1, 65537, 327679, 1, 65537, 262144, 1, 65537, 262145, 1, 196608, 262146, 1, 196608, 262147, 1, 196608, 262148, 1, 65537, 262149, 1, 65537, 262150, 1, 65537, 262151, 1, 65537, 262152, 1, 65537, 393207, 1, 65537, 393208, 1, 65537, 393209, 1, 65537, 393210, 1, 65537, 393211, 1, 65537, 393212, 1, 65537, 393213, 1, 65537, 393214, 1, 65536, 393215, 1, 65536, 327680, 1, 65536, 327681, 1, 65536, 327682, 1, 65537, 327683, 1, 65537, 327684, 1, 65537, 327685, 1, 65537, 327686, 1, 65537, 327687, 1, 65537, 327688, 1, 65537, 458743, 1, 65536, 458744, 1, 65536, 458745, 1, 65536, 458746, 1, 65536, 458747, 1, 65536, 458748, 1, 65536, 458749, 1, 65536, 458750, 1, 65536, 458751, 1, 65536, 393216, 1, 65536, 393217, 1, 65536, 393218, 1, 65536, 393219, 1, 65536, 393220, 1, 65536, 393221, 1, 65536, 393222, 1, 65536, 393223, 1, 65536, 393224, 1, 65536, 524279, 1, 65536, 524280, 1, 65536, 524281, 1, 65536, 524282, 1, 65536, 524283, 1, 65536, 524284, 1, 65536, 524285, 1, 65536, 524286, 1, 65536, 524287, 1, 65536, 458752, 1, 65536, 458753, 1, 65536, 458754, 1, 65536, 458755, 1, 65536, 458756, 1, 65536, 458757, 1, 65536, 458758, 1, 65536, 458759, 1, 65536, 458760, 1, 65536 )
script = ExtResource( 2 )
[node name="TileMap" type="TileMap" parent="."]
@ -26,3 +27,6 @@ format = 1
current = true
zoom = Vector2( 0.4, 0.4 )
script = ExtResource( 3 )
[node name="state_server" type="Node" parent="."]
script = ExtResource( 4 )

Binary file not shown.

View File

@ -1 +1,9 @@
use gdnative::prelude::*;
mod stateserver;
fn init(handle: InitHandle) {
handle.add_class::<stateserver::StateServer>();
}
godot_init!(init);

View File

@ -0,0 +1,18 @@
use gdnative::prelude::*;
#[derive(NativeClass)]
#[inherit(Node)]
pub struct StateServer;
#[methods]
impl StateServer {
fn new(_owner: &Node) -> Self {
StateServer
}
#[export]
fn _ready(&self, _owner: &Node) {
godot_print!("hello, state")
}
}