generated from hertog/godot-module-template
chore: progress
This commit is contained in:
parent
e7cf1d3b95
commit
38409781c3
33
engine/modules/sequester/client_window.cpp.old
Normal file
33
engine/modules/sequester/client_window.cpp.old
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "client_window.h"
|
||||
|
||||
SubViewport ClientWindow::get_target_sub_viewport() {
|
||||
return this->target_sub_viewport;
|
||||
}
|
||||
|
||||
void ClientWindow::set_target_sub_viewport(SubViewport new_sub_viewport) {
|
||||
this->target_sub_viewport = new_sub_viewport;
|
||||
}
|
||||
|
||||
Node2D ClientWindow::get_player() {
|
||||
return this->player;
|
||||
}
|
||||
|
||||
void ClientWindow::set_player(Node2D new_player) {
|
||||
this->player = new_player;
|
||||
}
|
||||
|
||||
void ClientWindow::set_world_2d() {
|
||||
this->world_2d = this->target_sub_viewport.find_world_2d();
|
||||
}
|
||||
|
||||
void ClientWindow::_bind_methods() {
|
||||
|
||||
}
|
||||
|
||||
void ClientWindow::_notification(int p_what) {
|
||||
|
||||
}
|
||||
|
||||
void ClientWindow::move_camera() {
|
||||
this->camera.position = this->player.position;
|
||||
}
|
12
engine/modules/sequester/client_window.h
Normal file
12
engine/modules/sequester/client_window.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef CLIENT_WINDOW_H
|
||||
#define CLIENT_WINDOW_H
|
||||
|
||||
#include "scene/main/window.h"
|
||||
|
||||
class ClientWindow : public Window {
|
||||
GDCLASS(ClientWindow, Window);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // !CLIENT_WINDOW_H
|
31
engine/modules/sequester/client_window.h.old
Normal file
31
engine/modules/sequester/client_window.h.old
Normal file
|
@ -0,0 +1,31 @@
|
|||
#ifndef CLIENT_WINDOW_H
|
||||
#define CLIENT_WINDOW_H
|
||||
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
|
||||
class ClientWindow : public Window {
|
||||
GDCLASS(ClientWindow, Window);
|
||||
|
||||
private:
|
||||
SubViewport target_sub_viewport {};
|
||||
Node2D player {};
|
||||
|
||||
public:
|
||||
SubViewport get_target_sub_viewport();
|
||||
void set_target_sub_viewport(SubViewport new_sub_viewport);
|
||||
|
||||
Node2D get_player();
|
||||
void set_player(Node2D new_player);
|
||||
|
||||
void set_world_2d();
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
|
||||
private:
|
||||
void move_camera();
|
||||
};
|
||||
|
||||
#endif // !CLIENT_WINDOW_H
|
|
@ -1,11 +1,13 @@
|
|||
#include "register_types.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "client_window.h"
|
||||
|
||||
void initialize_sequester_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
return;
|
||||
}
|
||||
ClassDB::register_class<ClientWindow>();
|
||||
}
|
||||
|
||||
void uninitialize_sequester_module(ModuleInitializationLevel p_level) {
|
||||
|
|
|
@ -13,19 +13,19 @@ autoplay = true
|
|||
|
||||
[node name="Level" type="SubViewport" parent="."]
|
||||
|
||||
[node name="Level" parent="Level" instance=ExtResource("2_rnkuw")]
|
||||
[node name="Level2" parent="Level" instance=ExtResource("2_rnkuw")]
|
||||
|
||||
[node name="Player" parent="Level/Level" index="0"]
|
||||
[node name="Player" parent="Level/Level2" index="0"]
|
||||
player_number = 1
|
||||
|
||||
[node name="Player2" parent="Level/Level" index="1"]
|
||||
[node name="Player2" parent="Level/Level2" index="1"]
|
||||
player_number = 2
|
||||
|
||||
[node name="Window" parent="." node_paths=PackedStringArray("player") instance=ExtResource("9_jx6rg")]
|
||||
title = "Window1"
|
||||
position = Vector2i(1000, 36)
|
||||
size = Vector2i(800, 480)
|
||||
player = NodePath("../Level/Level/Player")
|
||||
player = NodePath("../Level/Level2/Player")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="Window"]
|
||||
zoom = Vector2(2, 2)
|
||||
|
@ -35,11 +35,11 @@ zoom = Vector2(2, 2)
|
|||
[node name="Window2" parent="." node_paths=PackedStringArray("player") instance=ExtResource("9_jx6rg")]
|
||||
title = "Window2"
|
||||
size = Vector2i(800, 480)
|
||||
player = NodePath("../Level/Level/Player2")
|
||||
player = NodePath("../Level/Level2/Player2")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="Window2"]
|
||||
zoom = Vector2(2, 2)
|
||||
|
||||
[node name="ParallaxBg" parent="Window2" instance=ExtResource("8")]
|
||||
|
||||
[editable path="Level/Level"]
|
||||
[editable path="Level/Level2"]
|
||||
|
|
|
@ -6,7 +6,6 @@ extends Window
|
|||
func _ready() -> void:
|
||||
var world = get_node("../Level").find_world_2d()
|
||||
world_2d = world
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
camera.position = player.position
|
||||
|
|
Loading…
Reference in a new issue