work on editor improvements
This commit is contained in:
parent
bf8f8d164a
commit
c1c846dfb6
@ -61,6 +61,12 @@ tick_console :: () {
|
|||||||
while console_report.count > MAX_REPORT_ROWS {
|
while console_report.count > MAX_REPORT_ROWS {
|
||||||
array_ordered_remove_by_index(*console_report, 0);
|
array_ordered_remove_by_index(*console_report, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if console_state != .CLOSED {
|
||||||
|
console_open_ignore_input = true;
|
||||||
|
} else {
|
||||||
|
console_open_ignore_input = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console_input_start : string = "";
|
console_input_start : string = "";
|
||||||
|
|||||||
@ -14,6 +14,10 @@ current_editor_view : Editor_View = .Trile_Editor;
|
|||||||
|
|
||||||
#scope_export
|
#scope_export
|
||||||
|
|
||||||
|
// Used when the console is open, so typing doesn't cause all sorts of stuff.
|
||||||
|
console_open_ignore_input : bool = false;
|
||||||
|
|
||||||
|
|
||||||
draw_editor_ui :: (theme: *GR.Overall_Theme) {
|
draw_editor_ui :: (theme: *GR.Overall_Theme) {
|
||||||
r := GR.get_rect(0,0,0,0);
|
r := GR.get_rect(0,0,0,0);
|
||||||
r.x = 0; r.w = 100*vw;
|
r.x = 0; r.w = 100*vw;
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
// @ToDo do a config tweak file thing like jblow has and add this there.
|
// @ToDo do a config tweak file thing like jblow has and add this there.
|
||||||
CAMERA_INACTIVE_TIME_TO_ORBIT :: 20.0;
|
CAMERA_INACTIVE_TIME_TO_ORBIT :: 20.0;
|
||||||
|
MAX_CAMERA_DIST :: 25.0;
|
||||||
|
MIN_CAMERA_DIST :: 2.0;
|
||||||
|
DIST_SCROLL_SPEED :: 0.8;
|
||||||
|
|
||||||
mouse2Active : bool;
|
mouse2Active : bool;
|
||||||
mouse2ActivationPosition : Vector2;
|
mouse2ActivationPosition : Vector2;
|
||||||
@ -40,11 +43,13 @@ get_level_editor_camera :: () -> Camera {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tick_level_editor_camera :: () {
|
tick_level_editor_camera :: () {
|
||||||
|
if console_open_ignore_input then return;
|
||||||
|
|
||||||
if get_time() - lastInputTime > CAMERA_INACTIVE_TIME_TO_ORBIT { // idle rotating camera
|
if get_time() - lastInputTime > CAMERA_INACTIVE_TIME_TO_ORBIT { // idle rotating camera
|
||||||
cameraRotation += cast(float) delta_time;
|
cameraRotation += cast(float) delta_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraSpeed :: 5.1;
|
cameraSpeed :: 150;
|
||||||
|
|
||||||
forward : Vector3 = .{1, 0, 0};
|
forward : Vector3 = .{1, 0, 0};
|
||||||
qrotation : Quaternion = .{cos(-cameraRotation/2.0),0,sin(-cameraRotation/2.0),0};
|
qrotation : Quaternion = .{cos(-cameraRotation/2.0),0,sin(-cameraRotation/2.0),0};
|
||||||
@ -57,22 +62,27 @@ tick_level_editor_camera :: () {
|
|||||||
rotate(*left, qrotation_left);
|
rotate(*left, qrotation_left);
|
||||||
left2d := Vector2.{left.x, left.z};
|
left2d := Vector2.{left.x, left.z};
|
||||||
|
|
||||||
|
cameraDist = clamp(cameraDist - mouse_delta_z * DIST_SCROLL_SPEED, MIN_CAMERA_DIST, MAX_CAMERA_DIST);
|
||||||
|
|
||||||
|
distRange : float = MAX_CAMERA_DIST - MIN_CAMERA_DIST;
|
||||||
|
zoomCameraMovementMultiplier := 0.03 + ((cameraDist - MIN_CAMERA_DIST) / distRange) * 0.15;
|
||||||
|
|
||||||
if input_button_states[#char "W"] & .DOWN {
|
if input_button_states[#char "W"] & .DOWN {
|
||||||
lastInputTime = get_time();
|
lastInputTime = get_time();
|
||||||
cameraCenter += -cameraSpeed * (xx delta_time) * forward2d;
|
cameraCenter += -cameraSpeed * zoomCameraMovementMultiplier * (xx delta_time) * forward2d;
|
||||||
}
|
}
|
||||||
if input_button_states[#char "S"] & .DOWN {
|
if input_button_states[#char "S"] & .DOWN {
|
||||||
lastInputTime = get_time();
|
lastInputTime = get_time();
|
||||||
cameraCenter += cameraSpeed * (xx delta_time) * forward2d;
|
cameraCenter += cameraSpeed * zoomCameraMovementMultiplier * (xx delta_time) * forward2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
if input_button_states[#char "A"] & .DOWN {
|
if input_button_states[#char "A"] & .DOWN {
|
||||||
lastInputTime = get_time();
|
lastInputTime = get_time();
|
||||||
cameraCenter += -cameraSpeed * (xx delta_time) * left2d;
|
cameraCenter += -cameraSpeed * zoomCameraMovementMultiplier * (xx delta_time) * left2d;
|
||||||
}
|
}
|
||||||
if input_button_states[#char "D"] & .DOWN {
|
if input_button_states[#char "D"] & .DOWN {
|
||||||
lastInputTime = get_time();
|
lastInputTime = get_time();
|
||||||
cameraCenter += cameraSpeed * (xx delta_time) * left2d;
|
cameraCenter += cameraSpeed * zoomCameraMovementMultiplier * (xx delta_time) * left2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
if input_button_states[Key_Code.ARROW_UP] & .START {
|
if input_button_states[Key_Code.ARROW_UP] & .START {
|
||||||
@ -104,12 +114,13 @@ tick_level_editor_camera :: () {
|
|||||||
mouse2Active = false;
|
mouse2Active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if input_button_states[Key_Code.MOUSE_BUTTON_MIDDLE] & .DOWN {
|
if input_button_states[Key_Code.MOUSE_BUTTON_MIDDLE] & .DOWN {
|
||||||
if mouse3Active {
|
if mouse3Active {
|
||||||
lastInputTime = get_time();
|
lastInputTime = get_time();
|
||||||
diff := mouse3ActivationPosition - Vector2.{input_mouse_x, input_mouse_y};
|
diff := mouse3ActivationPosition - Vector2.{input_mouse_x, input_mouse_y};
|
||||||
cameraCenter = cameraCenter + forward2d * -diff.y * cast(float) delta_time * 0.1;
|
cameraCenter = cameraCenter + forward2d * -diff.y * cast(float) delta_time * zoomCameraMovementMultiplier;
|
||||||
cameraCenter = cameraCenter + left2d * -diff.x * cast(float) delta_time * 0.1;
|
cameraCenter = cameraCenter + left2d * -diff.x * cast(float) delta_time * zoomCameraMovementMultiplier;
|
||||||
} else {
|
} else {
|
||||||
mouse3Active = true;
|
mouse3Active = true;
|
||||||
mouse3ActivationPosition = Vector2.{input_mouse_x, input_mouse_y};
|
mouse3ActivationPosition = Vector2.{input_mouse_x, input_mouse_y};
|
||||||
@ -118,6 +129,7 @@ tick_level_editor_camera :: () {
|
|||||||
mouse3Active = false;
|
mouse3Active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#scope_export
|
#scope_export
|
||||||
|
|||||||
@ -106,6 +106,8 @@ handle_tool_click :: () {
|
|||||||
current_color : Vector3 = .{1.0, 0.0, 0.0};
|
current_color : Vector3 = .{1.0, 0.0, 0.0};
|
||||||
|
|
||||||
tick_trile_editor :: () {
|
tick_trile_editor :: () {
|
||||||
|
if console_open_ignore_input then return;
|
||||||
|
|
||||||
if !current_trile then current_trile = get_trile("test");
|
if !current_trile then current_trile = get_trile("test");
|
||||||
|
|
||||||
if input_button_states[Key_Code.MOUSE_BUTTON_LEFT] & .START {
|
if input_button_states[Key_Code.MOUSE_BUTTON_LEFT] & .START {
|
||||||
@ -300,6 +302,8 @@ draw_trile :: () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
trile_editor_shortcuts :: () {
|
trile_editor_shortcuts :: () {
|
||||||
|
if console_open_ignore_input then return;
|
||||||
|
|
||||||
if input_button_states[Key_Code.CTRL] & .DOWN {
|
if input_button_states[Key_Code.CTRL] & .DOWN {
|
||||||
if input_button_states[#char "A"] & .START {
|
if input_button_states[#char "A"] & .START {
|
||||||
current_mode = .AREA;
|
current_mode = .AREA;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user