Skip to content

Commit

Permalink
Fixed Nu and Gaia .fsx scripts that used to reference dead Prime.exe.
Browse files Browse the repository at this point in the history
Some code clean-up in preparation for intermediate releases.


Former-commit-id: 93d72b6
  • Loading branch information
bryanedds committed Jul 9, 2016
1 parent ab5ec09 commit 230e7b3
Show file tree
Hide file tree
Showing 17 changed files with 155 additions and 5,680 deletions.
3 changes: 2 additions & 1 deletion Nu/Nu/Nu.Gaia/GaiaFunctions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,8 @@ module Gaia =
then World.exit world
else world

let private attachToWorld targetDir form world =
/// Attach Gaia to the given world.
let attachToWorld targetDir form world =
match World.getUserState world : obj with
| :? unit ->
if World.getSelectedScreen world = Simulants.EditorScreen then
Expand Down
4 changes: 2 additions & 2 deletions Nu/Nu/Nu.Gaia/Interactive.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#r "../../../Prime/xUnit/xunit.dll"
#r "../../../Nu/FSharpx.Core/FSharpx.Core.dll"
#r "../../../Nu/FSharpx.Collections/FSharpx.Collections.dll"
#r "../../../Nu/Prime/Release/Prime.exe"
#r "../../../Nu/Farseer/FarseerPhysics.dll"
#r "../../../Nu/Magick.NET/Magick.NET-AnyCPU.dll"
#r "../../../Nu/SDL2#/Debug/SDL2#.dll"
#r "../../../Nu/TiledSharp/Release/TiledSharp.dll"
#r "../../../Nu/TiledSharp/Debug/TiledSharp.dll"
#r "../../../SDL2Addendum/SDL2Addendum/SDL2Addendum/bin/Debug/SDL2Addendum.dll"
#r "../../../Prime/Prime/Prime/bin/Debug/Prime.exe"
#r "../../../Nu/Nu/Nu/bin/Debug/Nu.exe"
#r "../../../Nu/Nu/Nu.Gaia.Design/bin/Debug/Nu.Gaia.Design.exe"
#r "../../../Nu/Nu/Nu.Gaia/bin/Debug/Nu.Gaia.exe"
Expand Down
6 changes: 3 additions & 3 deletions Nu/Nu/Nu/Interactive.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#r "../../../Prime/xUnit/xunit.dll"
#r "../../../Nu/FSharpx.Core/FSharpx.Core.dll"
#r "../../../Nu/FSharpx.Collections/FSharpx.Collections.dll"
#r "../../../Nu/Prime/Release/Prime.exe"
#r "../../../Nu/Farseer/FarseerPhysics.dll"
#r "../../../Nu/Magick.NET/Magick.NET-AnyCPU.dll"
#r "../../../Nu/SDL2#/Release/SDL2#.dll"
#r "../../../Nu/TiledSharp/Release/TiledSharp.dll"
#r "../../../Nu/SDL2#/Debug/SDL2#.dll"
#r "../../../Nu/TiledSharp/Debug/TiledSharp.dll"
#r "../../../SDL2Addendum/SDL2Addendum/SDL2Addendum/bin/Debug/SDL2Addendum.dll"
#r "../../../Prime/Prime/Prime/bin/Debug/Prime.exe"
#r "../../../Nu/Nu/Nu/bin/Debug/Nu.exe"

open System
Expand Down
1 change: 1 addition & 0 deletions Nu/Nu/Nu/Nu.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<Compile Include="AmbientState.fs" />
<Compile Include="WorldTypes.fs" />
<Compile Include="WorldTypes2.fs" />
<Compile Include="WorldEvents.fs" />
<Compile Include="WorldFacet.fs" />
<Compile Include="WorldEntity.fs" />
<Compile Include="WorldGroup.fs" />
Expand Down
9 changes: 5 additions & 4 deletions Nu/Nu/Nu/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ module Program =
system | language | editor
-----------------------------------------------
overlay | s-expr DSL | Visual Studio
asset graph | s-expr DSL | Visual Studio
overlay | s-expr DSL | Visual Studio & Gaia
asset graph | s-expr DSL | Visual Studio & Gaia
simulants defs | s-expr DSL | Gaia
event filtering | s-expr DSL | Gaia
collision bodies| s-expr DSL | Gaia
effect system | s-expr DSL | Aether (TBA)
mind (TBA) | s-expr DSL | Pheobe (TBA) - http://www.cs.uu.nl/research/techreps/repo/CS-2013/2013-003.pdf
effect system | s-expr DSL | Gaia & Aether (TBA)
mind(TBA) | s-expr DSL | Gaia & Pheobe (TBA) - http://www.cs.uu.nl/research/techreps/repo/CS-2013/2013-003.pdf
vsrl script(WIP)| s-expr DSL | Visual Studio & Gaia
interactions | F# (chains) | Visual Studio
subsystems | F# | Visual Studio
dispatchers | F# | Visual Studio
Expand Down
18 changes: 6 additions & 12 deletions Nu/Nu/Nu/Reflection.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ type [<NoEquality; NoComparison>] PropertyExpr =
| DefineExpr of obj
| VariableExpr of (unit -> obj)

[<RequireQualifiedAccess; CompilationRepresentation (CompilationRepresentationFlags.ModuleSuffix)>]
module PropertyExpr =

/// Evaluate a property expression.
let eval expr =
static member eval expr =
match expr with
| DefineExpr value -> value
| VariableExpr fn -> fn ()
Expand All @@ -30,11 +27,8 @@ type [<NoEquality; NoComparison>] PropertyDefinition =
PropertyType : Type
PropertyExpr : PropertyExpr }

[<RequireQualifiedAccess; CompilationRepresentation (CompilationRepresentationFlags.ModuleSuffix)>]
module PropertyDefinition =

/// Validate a property definition.
let validate propertyDefinition =
static member validate propertyDefinition =
if propertyDefinition.PropertyName = "FacetNames" then failwith "FacetNames cannot be an intrinsic property."
if propertyDefinition.PropertyName = "OptOverlayName" then failwith "OptOverlayName cannot be an intrinsic property."
if Array.exists (fun gta -> gta = typeof<obj>) propertyDefinition.PropertyType.GenericTypeArguments then
Expand All @@ -43,13 +37,13 @@ module PropertyDefinition =
"Use explicit typing on all values that carry incomplete type information such as empty lists, empty sets, and none options."

/// Make a property definition.
let make propertyName propertyType propertyExpr =
static member make propertyName propertyType propertyExpr =
{ PropertyName = propertyName; PropertyType = propertyType; PropertyExpr = propertyExpr }

/// Make a property definition, validating it in the process.
let makeValidated propertyName propertyType propertyExpr =
let result = make propertyName propertyType propertyExpr
validate result
static member makeValidated propertyName propertyType propertyExpr =
let result = PropertyDefinition.make propertyName propertyType propertyExpr
PropertyDefinition.validate result
result

/// In tandem with the define literal, grants a nice syntax to define value properties.
Expand Down
101 changes: 101 additions & 0 deletions Nu/Nu/Nu/WorldEvents.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Nu Game Engine.
// Copyright (C) Bryan Edds, 2012-2016.

namespace Nu
open System
open OpenTK
open Prime
open Nu

/// The data for a mouse move event.
type [<StructuralEquality; NoComparison>] MouseMoveData =
{ Position : Vector2 }

/// The data for a mouse button event.
type [<StructuralEquality; NoComparison>] MouseButtonData =
{ Position : Vector2
Button : MouseButton
Down : bool }

/// The data for a keyboard key event.
type [<StructuralEquality; NoComparison>] KeyboardKeyData =
{ ScanCode : int
Repeated : bool
Down : bool }

/// The data for a collision event.
type [<StructuralEquality; NoComparison>] CollisionData =
{ Normal : Vector2
Speed : single
Collidee : Entity }

[<RequireQualifiedAccess>]
module Events =

let Any = Prime.Events.Any
let Subscribe = ntoa<obj Address> !!"Subscribe"
let Unsubscribe = ntoa<obj Address> !!"Unsubscribe"
let Update = ntoa<unit> !!"Update"
let Select = ntoa<unit> !!"Select"
let Deselect = ntoa<unit> !!"Deselect"
let Down = ntoa<unit> !!"Down"
let Up = ntoa<unit> !!"Up"
let Click = ntoa<unit> !!"Click"
let On = ntoa<unit> !!"On"
let Off = ntoa<unit> !!"Off"
let Touch = ntoa<Vector2> !!"Touch"
let Untouch = ntoa<Vector2> !!"Untouch"
let Mouse = ntoa<obj> !!"Mouse"
let MouseMove = Mouse -<- ntoa<MouseMoveData> !!"Move"
let MouseDrag = Mouse -<- ntoa<MouseMoveData> !!"Drag"
let MouseLeft = Mouse -<- ntoa<MouseButtonData> !!"Left"
let MouseCenter = Mouse -<- ntoa<MouseButtonData> !!"Center"
let MouseRight = Mouse -<- ntoa<MouseButtonData> !!"Right"
let MouseX1 = Mouse -<- ntoa<MouseButtonData> !!"X1"
let MouseX2 = Mouse -<- ntoa<MouseButtonData> !!"X2"
let MouseLeftDown = MouseLeft -|- ntoa !!"Down"
let MouseLeftUp = MouseLeft -|- ntoa !!"Up"
let MouseLeftChange = MouseLeft -|- ntoa !!"Change"
let MouseCenterDown = MouseCenter -|- ntoa !!"Down"
let MouseCenterUp = MouseCenter -|- ntoa !!"Up"
let MouseCenterChange = MouseCenter -|- ntoa !!"Change"
let MouseRightDown = MouseRight -|- ntoa !!"Down"
let MouseRightUp = MouseRight -|- ntoa !!"Up"
let MouseRightChange = MouseRight -|- ntoa !!"Change"
let MouseX1Down = MouseX1 -|- ntoa !!"Down"
let MouseX1Up = MouseX1 -|- ntoa !!"Up"
let MouseX1Change = MouseX1 -|- ntoa !!"Change"
let MouseX2Down = MouseX2 -|- ntoa !!"Down"
let MouseX2Up = MouseX2 -|- ntoa !!"Up"
let MouseX2Change = MouseX2 -|- ntoa !!"Change"
let KeyboardKey = ntoa<obj> !!"KeyboardKey"
let KeyboardKeyDown = Mouse -<- ntoa<KeyboardKeyData> !!"Down"
let KeyboardKeyUp = Mouse -<- ntoa<KeyboardKeyData> !!"Up"
let KeyboardKeyChange = Mouse -<- ntoa<KeyboardKeyData> !!"Change"
let Collision = ntoa<CollisionData> !!"Collision"
let Incoming = ntoa<unit> !!"Incoming"
let IncomingStart = Incoming -|- ntoa !!"Start"
let IncomingFinish = Incoming -|- ntoa !!"Finish"
let Outgoing = ntoa<unit> !!"Outgoing"
let OutgoingStart = Outgoing -|- ntoa !!"Start"
let OutgoingFinish = Outgoing -|- ntoa !!"Finish"
let Assets = ntoa<obj> !!"Assets"
let AssetsReload = Assets -<- ntoa<unit> !!"Reload"
let Ambient = ntoa<obj> !!"Ambient"
let AmbientChange = Ambient -<- ntoa<AmbientChangeData> !!"Change"
let AmbientChangeProperty = fun propertyName -> Ambient -<- ltoa<AmbientChangeData> [!!"Change"; !!propertyName]
let Game = ntoa<obj> !!"Game"
let GameChange = Game -<- ntoa<ParticipantChangeData<Game, World>> !!"Change"
let Screen = ntoa<obj> !!"Screen"
let ScreenAdd = Screen -<- ntoa<unit> !!"Add"
let ScreenRemoving = Screen -<- ntoa<unit> !!"Removing"
let ScreenChange = Screen -<- ntoa<ParticipantChangeData<Screen, World>> !!"Change"
let Group = ntoa<obj> !!"Group"
let GroupAdd = Group -<- ntoa<unit> !!"Add"
let GroupRemoving = Group -<- ntoa<unit> !!"Removing"
let GroupChange = Group -<- ntoa<ParticipantChangeData<Group, World>> !!"Change"
let Entity = ntoa<obj> !!"Entity"
let EntityAdd = Entity -<- ntoa<unit> !!"Add"
let EntityRemoving = Entity -<- ntoa<unit> !!"Removing"
let EntityChange = Entity -<- ntoa<ParticipantChangeData<Entity, World>> !!"Change"
let EntityChangeProperty = fun propertyName -> Entity -<- ltoa<ParticipantChangeData<Entity, World>> [!!"Change"; !!propertyName]
2 changes: 1 addition & 1 deletion Nu/Nu/Nu/WorldScripting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,4 @@ module Scripting =
type [<NoEquality; NoComparison>] ScriptSystem =
private
{ Scripts : Vmap<Guid, Script>
Debugging : bool }
Debugging : bool }
161 changes: 34 additions & 127 deletions Nu/Nu/Nu/WorldTypes2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,41 @@ open System
open OpenTK
open Prime
open Nu

/// Provides a way to make user-defined dispatchers, facets, and various other sorts of game-
/// specific values.
type NuPlugin () =

/// Make user-defined subsystems such that Nu can utilitze them at run-time.
abstract MakeSubsystems : unit -> (string * World Subsystem) list
default this.MakeSubsystems () = []

/// Optionally make a user-defined game dispatchers such that Nu can utilize it at run-time.
abstract MakeOptGameDispatcher : unit -> GameDispatcher option
default this.MakeOptGameDispatcher () = None

/// Make user-defined screen dispatchers such that Nu can utilize them at run-time.
abstract MakeScreenDispatchers : unit -> ScreenDispatcher list
default this.MakeScreenDispatchers () = []

/// Make user-defined group dispatchers such that Nu can utilize them at run-time.
abstract MakeGroupDispatchers : unit -> GroupDispatcher list
default this.MakeGroupDispatchers () = []

/// Make user-defined entity dispatchers such that Nu can utilize them at run-time.
abstract MakeEntityDispatchers : unit -> EntityDispatcher list
default this.MakeEntityDispatchers () = []

/// Make user-defined assets such that Nu can utilize them at run-time.
abstract MakeFacets : unit -> Facet list
default this.MakeFacets () = []

/// The data for a mouse move event.
type [<StructuralEquality; NoComparison>] MouseMoveData =
{ Position : Vector2 }

/// The data for a mouse button event.
type [<StructuralEquality; NoComparison>] MouseButtonData =
{ Position : Vector2
Button : MouseButton
Down : bool }

/// The data for a keyboard key event.
type [<StructuralEquality; NoComparison>] KeyboardKeyData =
{ ScanCode : int
Repeated : bool
Down : bool }

/// The data for a collision event.
type [<StructuralEquality; NoComparison>] CollisionData =
{ Normal : Vector2
Speed : single
Collidee : Entity }
/// Make the overlay routes that will allow Nu to use different overlays for the specified
/// types. For example, a returned router of (typeof<ButtonDispatcher>.Name, Some "CustomButtonOverlay")
/// will cause all buttons to use the overlay with the name "CustomButtonOverlay" rather
/// than the default "ButtonDispatcher" overlay.
abstract MakeOverlayRoutes : unit -> (string * string option) list
default this.MakeOverlayRoutes () = []

/// Describes an entity value independent of the engine.
type [<NoComparison>] EntityDescriptor =
Expand Down Expand Up @@ -75,112 +88,6 @@ type [<NoComparison>] GameDescriptor =
GameProperties = Map.empty
Screens = [] }

/// Provides a way to make user-defined dispatchers, facets, and various other sorts of game-
/// specific values.
type NuPlugin () =

/// Make user-defined subsystems such that Nu can utilitze them at run-time.
abstract MakeSubsystems : unit -> (string * World Subsystem) list
default this.MakeSubsystems () = []

/// Optionally make a user-defined game dispatchers such that Nu can utililize it at run-time.
abstract MakeOptGameDispatcher : unit -> GameDispatcher option
default this.MakeOptGameDispatcher () = None

/// Make user-defined screen dispatchers such that Nu can utililize them at run-time.
abstract MakeScreenDispatchers : unit -> ScreenDispatcher list
default this.MakeScreenDispatchers () = []

/// Make user-defined group dispatchers such that Nu can utililize them at run-time.
abstract MakeGroupDispatchers : unit -> GroupDispatcher list
default this.MakeGroupDispatchers () = []

/// Make user-defined entity dispatchers such that Nu can utililize them at run-time.
abstract MakeEntityDispatchers : unit -> EntityDispatcher list
default this.MakeEntityDispatchers () = []

/// Make user-defined assets such that Nu can utililize them at run-time.
abstract MakeFacets : unit -> Facet list
default this.MakeFacets () = []

/// Make the overlay routes that will allow Nu to use different overlays for the specified
/// types. For example, a returned router of (typeof<ButtonDispatcher>.Name, Some "CustomButtonOverlay")
/// will cause all buttons to use the overlay with the name "CustomButtonOverlay" rather
/// than the default "ButtonDispatcher" overlay.
abstract MakeOverlayRoutes : unit -> (string * string option) list
default this.MakeOverlayRoutes () = []

[<RequireQualifiedAccess>]
module Events =

let Any = Prime.Events.Any
let Subscribe = ntoa<obj Address> !!"Subscribe"
let Unsubscribe = ntoa<obj Address> !!"Unsubscribe"
let Update = ntoa<unit> !!"Update"
let Select = ntoa<unit> !!"Select"
let Deselect = ntoa<unit> !!"Deselect"
let Down = ntoa<unit> !!"Down"
let Up = ntoa<unit> !!"Up"
let Click = ntoa<unit> !!"Click"
let On = ntoa<unit> !!"On"
let Off = ntoa<unit> !!"Off"
let Touch = ntoa<Vector2> !!"Touch"
let Untouch = ntoa<Vector2> !!"Untouch"
let Mouse = ntoa<obj> !!"Mouse"
let MouseMove = Mouse -<- ntoa<MouseMoveData> !!"Move"
let MouseDrag = Mouse -<- ntoa<MouseMoveData> !!"Drag"
let MouseLeft = Mouse -<- ntoa<MouseButtonData> !!"Left"
let MouseCenter = Mouse -<- ntoa<MouseButtonData> !!"Center"
let MouseRight = Mouse -<- ntoa<MouseButtonData> !!"Right"
let MouseX1 = Mouse -<- ntoa<MouseButtonData> !!"X1"
let MouseX2 = Mouse -<- ntoa<MouseButtonData> !!"X2"
let MouseLeftDown = MouseLeft -|- ntoa !!"Down"
let MouseLeftUp = MouseLeft -|- ntoa !!"Up"
let MouseLeftChange = MouseLeft -|- ntoa !!"Change"
let MouseCenterDown = MouseCenter -|- ntoa !!"Down"
let MouseCenterUp = MouseCenter -|- ntoa !!"Up"
let MouseCenterChange = MouseCenter -|- ntoa !!"Change"
let MouseRightDown = MouseRight -|- ntoa !!"Down"
let MouseRightUp = MouseRight -|- ntoa !!"Up"
let MouseRightChange = MouseRight -|- ntoa !!"Change"
let MouseX1Down = MouseX1 -|- ntoa !!"Down"
let MouseX1Up = MouseX1 -|- ntoa !!"Up"
let MouseX1Change = MouseX1 -|- ntoa !!"Change"
let MouseX2Down = MouseX2 -|- ntoa !!"Down"
let MouseX2Up = MouseX2 -|- ntoa !!"Up"
let MouseX2Change = MouseX2 -|- ntoa !!"Change"
let KeyboardKey = ntoa<obj> !!"KeyboardKey"
let KeyboardKeyDown = Mouse -<- ntoa<KeyboardKeyData> !!"Down"
let KeyboardKeyUp = Mouse -<- ntoa<KeyboardKeyData> !!"Up"
let KeyboardKeyChange = Mouse -<- ntoa<KeyboardKeyData> !!"Change"
let Collision = ntoa<CollisionData> !!"Collision"
let Incoming = ntoa<unit> !!"Incoming"
let IncomingStart = Incoming -|- ntoa !!"Start"
let IncomingFinish = Incoming -|- ntoa !!"Finish"
let Outgoing = ntoa<unit> !!"Outgoing"
let OutgoingStart = Outgoing -|- ntoa !!"Start"
let OutgoingFinish = Outgoing -|- ntoa !!"Finish"
let Assets = ntoa<obj> !!"Assets"
let AssetsReload = Assets -<- ntoa<unit> !!"Reload"
let Ambient = ntoa<obj> !!"Ambient"
let AmbientChange = Ambient -<- ntoa<AmbientChangeData> !!"Change"
let AmbientChangeProperty = fun propertyName -> Ambient -<- ltoa<AmbientChangeData> [!!"Change"; !!propertyName]
let Game = ntoa<obj> !!"Game"
let GameChange = Game -<- ntoa<ParticipantChangeData<Game, World>> !!"Change"
let Screen = ntoa<obj> !!"Screen"
let ScreenAdd = Screen -<- ntoa<unit> !!"Add"
let ScreenRemoving = Screen -<- ntoa<unit> !!"Removing"
let ScreenChange = Screen -<- ntoa<ParticipantChangeData<Screen, World>> !!"Change"
let Group = ntoa<obj> !!"Group"
let GroupAdd = Group -<- ntoa<unit> !!"Add"
let GroupRemoving = Group -<- ntoa<unit> !!"Removing"
let GroupChange = Group -<- ntoa<ParticipantChangeData<Group, World>> !!"Change"
let Entity = ntoa<obj> !!"Entity"
let EntityAdd = Entity -<- ntoa<unit> !!"Add"
let EntityRemoving = Entity -<- ntoa<unit> !!"Removing"
let EntityChange = Entity -<- ntoa<ParticipantChangeData<Entity, World>> !!"Change"
let EntityChangeProperty = fun propertyName -> Entity -<- ltoa<ParticipantChangeData<Entity, World>> [!!"Change"; !!propertyName]

[<AutoOpen; CompilationRepresentation (CompilationRepresentationFlags.ModuleSuffix)>]
module SimulantOperators =

Expand Down
Loading

0 comments on commit 230e7b3

Please sign in to comment.