+ WPF Support

This commit is contained in:
Michel Fedde 2021-01-31 12:54:50 +01:00
parent 6f23a80f7f
commit 41421b1df9
12 changed files with 94 additions and 14 deletions

View file

@ -15,6 +15,7 @@ using System.Windows.Shapes;
using OpenTK.Graphics;
using SM2D;
using SM2D.Drawing;
using SM2D.Pipelines;
using SM2D.Scene;
namespace SM_WPF_TEST
@ -37,10 +38,13 @@ namespace SM_WPF_TEST
gl.Start();
gl.SetScene(scene = new Scene());
gl.SetRenderPipeline(Default2DPipeline.Pipeline);
DrawObject2D cube = new DrawObject2D();
cube.Color = Color4.Blue;
scene.Objects.Add(cube);
new Window1().Show();
}
}
}

View file

@ -61,6 +61,9 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Window1.xaml.cs">
<DependentUpon>Window1.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -73,6 +76,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Window1.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">

12
SM_WPF_TEST/Window1.xaml Normal file
View file

@ -0,0 +1,12 @@
<Window x:Class="SM_WPF_TEST.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SM_WPF_TEST"
mc:Ignorable="d"
Title="Window1" Height="450" Width="800">
<Grid>
</Grid>
</Window>

View file

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using OpenTK.Graphics;
using SM2D;
using SM2D.Drawing;
using SM2D.Pipelines;
using SM2D.Scene;
namespace SM_WPF_TEST
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
GLWPFWindow2D gl;
Scene scene;
Content = gl = new GLWPFWindow2D();
gl.Start();
gl.SetScene(scene = new Scene());
gl.SetRenderPipeline(Basic2DPipeline.Pipeline);
DrawObject2D obj = new DrawObject2D()
{
Color = Color4.Red
};
obj.ApplyCircle();
scene.Objects.Add(obj);
}
}
}