mirror of https://github.com/dsrw/enu.git
Mode swapping
This commit is contained in:
parent
17f2665985
commit
ce81c96c10
|
@ -0,0 +1,30 @@
|
|||
[gd_resource type="Environment" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://textures/kloofendal_43d_clear_puresky_2k.hdr" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="PanoramaSky" id=1]
|
||||
panorama = ExtResource( 1 )
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
background_sky_orientation = Basis( -1, 1.52079e-08, -8.60899e-08, 0, 0.984753, 0.173958, 8.74228e-08, 0.173958, -0.984753 )
|
||||
background_energy = 0.5
|
||||
ambient_light_color = Color( 1, 1, 1, 1 )
|
||||
ambient_light_energy = 0.13
|
||||
fog_enabled = true
|
||||
fog_color = Color( 0, 0, 0, 1 )
|
||||
fog_sun_color = Color( 0.211765, 0.211765, 0.211765, 1 )
|
||||
fog_depth_begin = 150.0
|
||||
fog_depth_end = 200.0
|
||||
fog_height_max = 50.0
|
||||
tonemap_mode = 3
|
||||
tonemap_exposure = 0.05
|
||||
tonemap_white = 0.01
|
||||
dof_blur_far_distance = 200.0
|
||||
dof_blur_far_transition = 20.0
|
||||
dof_blur_far_quality = 0
|
||||
glow_enabled = true
|
||||
glow_bloom = 1.0
|
||||
glow_blend_mode = 1
|
||||
glow_high_quality = true
|
|
@ -288,8 +288,13 @@ zoom_out={
|
|||
}
|
||||
zoom_out.macosx={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":true,"command":true,"pressed":false,"scancode":45,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":true,"command":true,"pressed":false,"scancode":45,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":true,"command":true,"pressed":false,"scancode":45,"physical_scancode":0,"unicode":0,"raw_code":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":true,"command":true,"pressed":false,"scancode":45,"physical_scancode":0,"unicode":0,"raw_code":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
change_mode={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"physical_scancode":0,"unicode":0,"raw_code":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/env.tres" type="Environment" id=2]
|
||||
[ext_resource path="res://environments/default.tres" type="Environment" id=2]
|
||||
[ext_resource path="res://materials/default_ground.tres" type="Material" id=3]
|
||||
[ext_resource path="res://components/GroundNode.gdns" type="Script" id=4]
|
||||
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/kloofendal_43d_clear_puresky_2k.hdr-0e15b8dc0a9ca9f4741636157e01c926.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://textures/kloofendal_43d_clear_puresky_2k.hdr"
|
||||
dest_files=[ "res://.import/kloofendal_43d_clear_puresky_2k.hdr-0e15b8dc0a9ca9f4741636157e01c926.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
17
src/game.nim
17
src/game.nim
|
@ -6,7 +6,8 @@ import
|
|||
input, input_event, gd_os, node, scene_tree, packed_scene, sprite, control,
|
||||
viewport, viewport_texture, performance, label, theme, dynamic_font,
|
||||
resource_loader, main_loop, project_settings, input_map, input_event_action,
|
||||
input_event_key, global_constants, scroll_container, voxel_server
|
||||
input_event_key, global_constants, scroll_container, voxel_server,
|
||||
world_environment
|
||||
]
|
||||
|
||||
import core, types, globals, controllers, models/[serializers, units, colors]
|
||||
|
@ -24,6 +25,8 @@ const savable_flags = {
|
|||
ConsoleVisible, MouseCaptured, Flying, God, AltWalkSpeed, AltFlySpeed
|
||||
}
|
||||
|
||||
const game_modes = ["default", "dream_mode"]
|
||||
|
||||
var saved_transform {.threadvar.}: Transform
|
||||
var saved_rotation {.threadvar.}: float
|
||||
var saved_flags {.threadvar.}: set[LocalStateFlags]
|
||||
|
@ -43,6 +46,7 @@ gdobj Game of Node:
|
|||
force_quit_at = MonoTime.high
|
||||
node_controller: NodeController
|
||||
script_controller: ScriptController
|
||||
game_mode: int
|
||||
|
||||
method process*(delta: float) =
|
||||
Zen.thread_ctx.boop
|
||||
|
@ -412,6 +416,17 @@ gdobj Game of Node:
|
|||
elif event.is_action_pressed("quit"):
|
||||
if host_os != "macosx":
|
||||
state.push_flag Quitting
|
||||
elif event.is_action_pressed("change_mode"):
|
||||
self.game_mode += 1
|
||||
if self.game_mode >= game_modes.len:
|
||||
self.game_mode = 0
|
||||
let env =
|
||||
state.nodes.game.find_node("Level").get_node("WorldEnvironment") as
|
||||
WorldEnvironment
|
||||
let mode_scene =
|
||||
load(\"res://environments/{game_modes[self.game_mode]}.tres") as
|
||||
Environment
|
||||
env.environment = mode_scene
|
||||
elif EditorVisible notin state.local_flags:
|
||||
if event.is_action_pressed("toggle_mouse_captured"):
|
||||
state.set_flag MouseCaptured, MouseCaptured notin state.local_flags
|
||||
|
|
Loading…
Reference in New Issue