Editor UI
This commit is contained in:
@@ -153,7 +153,7 @@ screen_to_world :: (camera: Camera, screen_position: Vector2) -> Vector3 {
|
||||
return world_position;
|
||||
}
|
||||
|
||||
normalized_screen_to_ray_v2 :: (camera: *Camera, screen_position: Vector2) -> Ray {
|
||||
normalized_screen_to_ray_v2 :: (camera: Camera, screen_position: Vector2) -> Ray {
|
||||
nds : Vector2;
|
||||
nds.x = (2.0 * screen_position.x) - 1.0;
|
||||
nds.y = (2.0 * screen_position.y) - 1.0;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#placeholder deserialize_entity;
|
||||
|
||||
MAX_CACHED_PILES :: 8;
|
||||
last_unnamed_scene_id := 0;
|
||||
|
||||
Scene :: struct {
|
||||
name: string;
|
||||
@@ -44,7 +45,9 @@ visitor :: (info : *File_Visit_Info, files: *[..] Entity_File_Info) {
|
||||
}
|
||||
|
||||
load_scene :: (path: string) -> *Scene {
|
||||
scene := create_scene("", 1024);
|
||||
split_path := split(path, "/");
|
||||
name := split_path[split_path.count-1];
|
||||
scene := create_scene(name, 1024);
|
||||
|
||||
files : [..] Entity_File_Info;
|
||||
files.allocator = temp;
|
||||
@@ -86,9 +89,23 @@ unload_scene :: (scene: *Scene) {
|
||||
free(scene);
|
||||
}
|
||||
|
||||
create_scene :: (name: string, max_entities: s64 = 256) -> *Scene {
|
||||
create_scene :: (name: string = "", max_entities: s64 = 256) -> *Scene {
|
||||
scene := New(Scene);
|
||||
scene.name = copy_string(name);
|
||||
new_name := name;
|
||||
|
||||
// If no name was specified, we're going to pick an unused "unnamed_scene"-variant
|
||||
if new_name.count == 0 {
|
||||
while true {
|
||||
defer last_unnamed_scene_id += 1;
|
||||
temp_name := tprint("unnamed_scene_%", last_unnamed_scene_id);
|
||||
if !file_exists(tprint("../assets/scenes/%", temp_name)) {
|
||||
new_name = temp_name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scene.name = copy_string(new_name);
|
||||
|
||||
// Setup allocator
|
||||
scene.pool = .{};
|
||||
|
||||
Reference in New Issue
Block a user