update to latest MoonWorks API

main
cosmonaut 2022-08-29 22:11:51 -07:00
parent a7da12630c
commit 4b1a9feda1
5 changed files with 124 additions and 118 deletions

View File

@ -5,7 +5,7 @@
<TargetName>ProjectName</TargetName> <TargetName>ProjectName</TargetName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute> <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<LangVersion>8.0</LangVersion> <LangVersion>7.3</LangVersion>
<StartupObject>ProjectName.Program</StartupObject> <StartupObject>ProjectName.Program</StartupObject>
<AssemblyName>ProjectName</AssemblyName> <AssemblyName>ProjectName</AssemblyName>
<RootNamespace>ProjectName</RootNamespace> <RootNamespace>ProjectName</RootNamespace>

View File

@ -10,7 +10,7 @@ NOTE: OSX is broken right now because I need to set up MoltenVK.
- Project boilerplate code - Project boilerplate code
- VSCode build tasks - VSCode build tasks
- VSCode debugger integration - VSCode step debugger integration
## Requirements ## Requirements
@ -19,6 +19,7 @@ NOTE: OSX is broken right now because I need to set up MoltenVK.
- [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) on Windows - [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) on Windows
- [Visual Studio Code](https://code.visualstudio.com/) - [Visual Studio Code](https://code.visualstudio.com/)
- [VSCode C# Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp) - [VSCode C# Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp)
- [VSCode Omnisharp Extension](https://github.com/OmniSharp/omnisharp-vscode)
## Installation ## Installation
@ -33,7 +34,7 @@ NOTE: OSX is broken right now because I need to set up MoltenVK.
- Open the project directory in VSCode - Open the project directory in VSCode
- Press Ctrl-Shift-B to open the build tasks menu - Press Ctrl-Shift-B to open the build tasks menu
- Tasks use .NET 6.0 to build and run - Tasks use .NET 6.0 to build and run
- Press F5 to build and debug - Press F5 to build and run step debugger
## Acknowledgments ## Acknowledgments

View File

@ -25,7 +25,6 @@ function pullMoonWorks()
checkGit checkGit
cd lib cd lib
git submodule add https://gitea.moonside.games/MoonsideGames/MoonWorks.git git submodule add https://gitea.moonside.games/MoonsideGames/MoonWorks.git
git checkout main
cd .. cd ..
echo "Updating to the latest release of MoonWorks..." echo "Updating to the latest release of MoonWorks..."
git submodule update --init --recursive git submodule update --init --recursive
@ -42,7 +41,7 @@ function getLibs()
{ {
# Downloading # Downloading
echo "Downloading latest moonlibs..." echo "Downloading latest moonlibs..."
curl http://moonside.games/files/moonlibs.tar.bz2 > "$MY_DIR/moonlibs.tar.bz2" curl https://moonside.games/files/moonlibs.tar.bz2 > "$MY_DIR/moonlibs.tar.bz2"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Finished downloading!" echo "Finished downloading!"
else else
@ -53,7 +52,7 @@ function getLibs()
# Decompressing # Decompressing
echo "Decompressing moonlibs..." echo "Decompressing moonlibs..."
mkdir -p "$MY_DIR" mkdir -p "$MY_DIR"
tar xjC "$MY_DIR" -f "$MY_DIR"/moonlibs.tar.bz2 tar -xvC "$MY_DIR"/moonlibs -f "$MY_DIR"/moonlibs.tar.bz2
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Finished decompressing!" echo "Finished decompressing!"
echo "" echo ""
@ -64,8 +63,6 @@ function getLibs()
fi fi
} }
getLibs
read -p "Enter your project name or 'exit' to quit: " newProjectName read -p "Enter your project name or 'exit' to quit: " newProjectName
if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then
exit 1 exit 1
@ -74,10 +71,12 @@ fi
NEW_PROJECT_DIR="$MY_DIR/../$newProjectName" NEW_PROJECT_DIR="$MY_DIR/../$newProjectName"
if [ -d "$NEW_PROJECT_DIR" ]; then if [ -d "$NEW_PROJECT_DIR" ]; then
>&2 echo "ERROR: Directory already exists." >&2 echo "ERROR: Project directory already exists."
exit 1 exit 1
fi fi
getLibs
# copy everything into new dir # copy everything into new dir
cp -R "$MY_DIR" "$NEW_PROJECT_DIR" cp -R "$MY_DIR" "$NEW_PROJECT_DIR"
@ -98,8 +97,6 @@ rm ./LICENSE
rm -rf .git rm -rf .git
git init git init
git checkout -b main
git branch -D master
mkdir lib mkdir lib
pullMoonWorks pullMoonWorks

View File

@ -22,9 +22,16 @@ namespace ProjectName
ScreenMode = ScreenMode.Windowed ScreenMode = ScreenMode.Windowed
}; };
FramerateSettings framerateSettings = new FramerateSettings
{
Mode = FramerateMode.Uncapped,
Cap = 60
};
ProjectNameGame game = new ProjectNameGame( ProjectNameGame game = new ProjectNameGame(
windowCreateInfo, windowCreateInfo,
MoonWorks.Graphics.PresentMode.FIFORelaxed, MoonWorks.Graphics.PresentMode.FIFORelaxed,
framerateSettings,
true true
); );

View File

@ -8,8 +8,9 @@ namespace ProjectName
public ProjectNameGame( public ProjectNameGame(
WindowCreateInfo windowCreateInfo, WindowCreateInfo windowCreateInfo,
PresentMode presentMode, PresentMode presentMode,
FramerateSettings framerateSettings,
bool debugMode bool debugMode
) : base(windowCreateInfo, presentMode, 60, debugMode) ) : base(windowCreateInfo, presentMode, framerateSettings, 60, debugMode)
{ {
// Insert your game initialization logic here. // Insert your game initialization logic here.
} }
@ -19,7 +20,7 @@ namespace ProjectName
// Insert your game update logic here. // Insert your game update logic here.
} }
protected override void Draw(System.TimeSpan dt, double alpha) protected override void Draw(double alpha)
{ {
// Replace this with your own drawing code. // Replace this with your own drawing code.
@ -35,7 +36,7 @@ namespace ProjectName
GraphicsDevice.Submit(commandBuffer); GraphicsDevice.Submit(commandBuffer);
} }
protected override void OnDestroy() protected override void Destroy()
{ {
} }