<commit_before>﻿// Gaia - The Nu Game Engine editor.
// Copyright (C) <NAME>, 2013-2020.

namespace Nu.Gaia
open System
open System.Collections.Generic
open System.Numerics
open Prime
open Nu
open Nu.Gaia.Design

type WorldChanger = World -> World
type WorldChangers = WorldChanger List

type DragEntityState =
    | DragEntityPosition2d of MousePositionWorldOrig : Vector2 * EntityDragOffset : Vector2 * Entity : Entity
    | DragEntityRotation2d of MousePositionWorldOrig : Vector2 * EntityDragOffset : Vector2 * Entity : Entity
    | DragEntityPosition3d of EntityDragOffset : Vector3 * EntityPlane : Plane3 * Entity : Entity
    | DragEntityInactive

type DragEyeState =
    | DragEyePosition2d of Vector2 * Vector2
    | DragEyeInactive

type EditorState =
    { TargetDir : string
      mutable RightClickPosition : Vector2
      mutable DragEntityState : DragEntityState
      mutable DragEyeState : DragEyeState
      mutable OtherSnaps : single * single * single
      mutable SelectedGroup : Group
      mutable FilePaths : Map<Group Address, string>
      mutable RefreshHierarchyViewRequested : bool // HACK: make sure hierarchy view isn't updated more than once per frame.
      mutable PastWorlds : World list
      mutable FutureWorlds : World list }

type SavedState =
    { BinaryFilePath : string
      UseGameplayScreen : bool
      UseImperativeExecution : bool }

/// Globals needed to sync Nu with WinForms.
[<RequireQualifiedAccess>]
module Globals =

    let mutable Screen = Simulants.Default.Screen
    let mutable World = Unchecked.defaultof<World>
    let mutable EditorState = Unchecked.defaultof<EditorState>
    let mutable Form = Unchecked.defaultof<GaiaForm>
    let mutable WorldChangers = WorldChangers ()
    let mutable SelectEntity : Entity -> GaiaForm -> World -> unit = Unchecked.defaultof<_>

    let pushPastWorld pastWorld =
        let pastWorld = Nu.World.shelve pastWorld
        EditorState.PastWorlds <- pastWorld :: EditorState.PastWorlds
        EditorState.FutureWorlds <- []<commit_msg>Minor clean-up.<commit_after>﻿// Gaia - The Nu Game Engine editor.
// Copyright (C) <NAME>, 2013-2020.

namespace Nu.Gaia
open System
open System.Collections.Generic
open System.Numerics
open Prime
open Nu
open Nu.Gaia.Design

type WorldChanger = World -> World
type WorldChangers = WorldChanger List

type DragEntityState =
    | DragEntityPosition2d of MousePositionWorldOrig : Vector2 * EntityDragOffset : Vector2 * Entity : Entity
    | DragEntityRotation2d of MousePositionWorldOrig : Vector2 * EntityDragOffset : Vector2 * Entity : Entity
    | DragEntityPosition3d of EntityDragOffset : Vector3 * EntityPlane : Plane3 * Entity : Entity
    | DragEntityInactive

type DragEyeState =
    | DragEyePosition2d of Vector2 * Vector2
    | DragEyeInactive

type EditorState =
    { TargetDir : string
      mutable RightClickPosition : Vector2
      mutable DragEntityState : DragEntityState
      mutable DragEyeState : DragEyeState
      mutable OtherSnaps : single * single * single
      mutable SelectedGroup : Group
      mutable FilePaths : Map<Group Address, string>
      mutable RefreshHierarchyViewRequested : bool // HACK: make sure hierarchy view isn't updated more than once per frame.
      mutable PastWorlds : World list
      mutable FutureWorlds : World list }

type SavedState =
    { BinaryFilePath : string
      UseGameplayScreen : bool
      UseImperativeExecution : bool }

/// Globals needed to sync Nu with WinForms.
[<RequireQualifiedAccess>]
module Globals =

    let mutable SelectEntity : Entity -> GaiaForm -> World -> unit = Unchecked.defaultof<_>
    let mutable WorldChangers = WorldChangers ()
    let mutable Screen = Simulants.Default.Screen
    let mutable World = Unchecked.defaultof<World>
    let mutable EditorState = Unchecked.defaultof<EditorState>
    let mutable Form = Unchecked.defaultof<GaiaForm>

    let pushPastWorld pastWorld =
        let pastWorld = Nu.World.shelve pastWorld
        EditorState.PastWorlds <- pastWorld :: EditorState.PastWorlds
        EditorState.FutureWorlds <- []
{'fraction_non_alphanumeric': 0.0657184894556155, 'fraction_numerical': 0.010299166257969592, 'mean_word_length': 3.624716553287982, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7116897', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1122, 'n_words': 347}