mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-06-30 19:03:42 -04:00
Review and cleanup
- General cleanup. - Fixed missing functions from raymath. - Nuget info part of project file.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
@ -8,9 +8,6 @@ class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
//RayForms.Run();
|
||||
//return;
|
||||
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
@ -19,6 +16,9 @@ class Program
|
||||
// SetConfigFlags((int)Flag.WINDOW_UNDECORATED);
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||
|
||||
var model = LoadModel("bridge.obj");
|
||||
model.mesh.Vertices[0] = 5f;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
@ -45,6 +45,6 @@ class Program
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
|
102
Test/RayForms.cs
102
Test/RayForms.cs
@ -1,102 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using static Raylib.Raylib;
|
||||
|
||||
namespace Raylib
|
||||
{
|
||||
public partial class RayForms : Form
|
||||
{
|
||||
private Panel gamePanel;
|
||||
private bool windowAttached = false;
|
||||
|
||||
#region WinAPI Entry Points
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr SetWindowPos(IntPtr handle, IntPtr handleAfter, int x, int y, int cx, int cy, uint flags);
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr SetParent(IntPtr child, IntPtr newParent);
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr ShowWindow(IntPtr handle, int command);
|
||||
|
||||
#endregion
|
||||
|
||||
public RayForms()
|
||||
{
|
||||
Size = new Size(1024, 700);
|
||||
Text = "Rayforms";
|
||||
|
||||
gamePanel = new Panel();
|
||||
gamePanel.Size = new Size(800, 500);
|
||||
gamePanel.Location = new Point(50, 50);
|
||||
|
||||
Button button = new Button();
|
||||
button.Text = "Attach window";
|
||||
button.Size = new Size(150, 20);
|
||||
button.Location = new Point(
|
||||
(Size.Width / 2) - (button.Size.Width / 2),
|
||||
gamePanel.Location.Y + gamePanel.Size.Height + 10
|
||||
);
|
||||
button.Click += new EventHandler(ClickedButton);
|
||||
Controls.Add(button);
|
||||
Controls.Add(gamePanel);
|
||||
}
|
||||
|
||||
private void ClickedButton(object sender, EventArgs e)
|
||||
{
|
||||
if (!windowAttached)
|
||||
{
|
||||
// new Thread(Test).Start();
|
||||
Test();
|
||||
}
|
||||
}
|
||||
|
||||
private void Test()
|
||||
{
|
||||
SetConfigFlags((int)Flag.WINDOW_UNDECORATED);
|
||||
InitWindow(800, 480, "Rayforms test");
|
||||
SetTargetFPS(60);
|
||||
|
||||
IntPtr winHandle = GetWindowHandle();
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
SetWindowPos(winHandle, Handle, 0, 0, 0, 0, 0x0401 /*NOSIZE | SHOWWINDOW */);
|
||||
SetParent(winHandle, gamePanel.Handle);
|
||||
ShowWindow(winHandle, 1);
|
||||
windowAttached = true;
|
||||
}));
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, MAROON);
|
||||
|
||||
DrawText(GetFrameTime().ToString(), 100, 10, 15, MAROON);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
public static void Run()
|
||||
{
|
||||
Application.Run(new RayForms());
|
||||
}
|
||||
}
|
||||
}
|
@ -8,9 +8,25 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Test</RootNamespace>
|
||||
<AssemblyName>Test</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -84,27 +100,49 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.1\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RayForms.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="raylib-cs.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Bindings\Bindings.csproj">
|
||||
<Project>{363d543c-f690-41aa-8215-2d368ea7434e}</Project>
|
||||
<Project>{9f30944c-415b-4763-91c7-81721117879d}</Project>
|
||||
<Name>Bindings</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
7
Test/packages.config
Normal file
7
Test/packages.config
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="System.Buffers" version="4.4.0" targetFramework="net471" />
|
||||
<package id="System.Memory" version="4.5.1" targetFramework="net471" />
|
||||
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net471" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net471" />
|
||||
</packages>
|
Reference in New Issue
Block a user