Skip to content

Commit

Permalink
Minimum F# + MonoGame code
Browse files Browse the repository at this point in the history
  • Loading branch information
simsoll committed Dec 4, 2014
1 parent 4565c52 commit b76d729
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/
obj/
16 changes: 16 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="2.3.5.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
37 changes: 37 additions & 0 deletions Game1.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module Template

open Microsoft.Xna.Framework
open Microsoft.Xna.Framework.Graphics

type Game1 () as x =
inherit Game()

do x.Content.RootDirectory <- "Content"
let graphics = new GraphicsDeviceManager(x)
let mutable spriteBatch = Unchecked.defaultof<_>

override x.Initialize() =
x.IsMouseVisible <- true

do base.Initialize()
()

override x.LoadContent() =
spriteBatch <- new SpriteBatch(x.GraphicsDevice)

do base.LoadContent()
()

override x.Update (gameTime) =

do base.Update (gameTime)
()

override x.Draw (gameTime) =
do x.GraphicsDevice.Clear Color.CornflowerBlue

spriteBatch.Begin()

spriteBatch.End()

do base.Draw (gameTime)
7 changes: 7 additions & 0 deletions Program.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
open Template

[<EntryPoint>]
let main argv =
use g = new Game1()
g.Run()
0
91 changes: 91 additions & 0 deletions Template.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>2f9b9976-0077-45ff-b971-0ae79a3bfe95</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Template</RootNamespace>
<AssemblyName>Template</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion>
<Name>Template</Name>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<DocumentationFile>bin\Debug\Template.XML</DocumentationFile>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<DocumentationFile>bin\Release\Template.XML</DocumentationFile>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Lidgren.Network">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsGL\Lidgren.Network.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsGL\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>True</Private>
</Reference>
<Reference Include="OpenTK">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsGL\OpenTK.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="Tao.Sdl">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsGL\Tao.Sdl.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Game1.fs" />
<Compile Include="Program.fs" />
<None Include="App.config" />
<None Include="SDL.dll" />
</ItemGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '11.0'">
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
42 changes: 42 additions & 0 deletions Template.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Template", "Template.fsproj", "{2F9B9976-0077-45FF-B971-0AE79A3BFE95}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Debug|x86.ActiveCfg = Debug|Any CPU
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Release|Any CPU.Build.0 = Release|Any CPU
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{2F9B9976-0077-45FF-B971-0AE79A3BFE95}.Release|x86.ActiveCfg = Release|Any CPU
{DC53261E-CA35-4169-A674-89E7A07B5727}.Debug|Any CPU.ActiveCfg = Debug|x86
{DC53261E-CA35-4169-A674-89E7A07B5727}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{DC53261E-CA35-4169-A674-89E7A07B5727}.Debug|Mixed Platforms.Build.0 = Debug|x86
{DC53261E-CA35-4169-A674-89E7A07B5727}.Debug|x86.ActiveCfg = Debug|x86
{DC53261E-CA35-4169-A674-89E7A07B5727}.Debug|x86.Build.0 = Debug|x86
{DC53261E-CA35-4169-A674-89E7A07B5727}.Release|Any CPU.ActiveCfg = Release|x86
{DC53261E-CA35-4169-A674-89E7A07B5727}.Release|Mixed Platforms.ActiveCfg = Release|x86
{DC53261E-CA35-4169-A674-89E7A07B5727}.Release|Mixed Platforms.Build.0 = Release|x86
{DC53261E-CA35-4169-A674-89E7A07B5727}.Release|x86.ActiveCfg = Release|x86
{DC53261E-CA35-4169-A674-89E7A07B5727}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

0 comments on commit b76d729

Please sign in to comment.