diff options
| -rwxr-xr-x | Templates/RadioButton.goml | 2 | ||||
| -rw-r--r-- | Tests/GOLIBTest_4.cs | 7 | ||||
| -rw-r--r-- | Tests/GOLIBTest_Window.cs | 25 | ||||
| -rw-r--r-- | Tests/GOLIBTest_fps.cs | 33 | ||||
| -rwxr-xr-x | Tests/Interfaces/fps.goml | 40 | ||||
| -rwxr-xr-x | Tests/Interfaces/testWindow.goml | 10 | ||||
| -rw-r--r-- | Tests/Tests.csproj | 4 | ||||
| -rwxr-xr-x | src/OpenTKGameWindow.cs | 15 |
8 files changed, 58 insertions, 78 deletions
diff --git a/Templates/RadioButton.goml b/Templates/RadioButton.goml index 58fab68e..0d8ab32a 100755 --- a/Templates/RadioButton.goml +++ b/Templates/RadioButton.goml @@ -1,5 +1,5 @@ <?xml version="1.0"?>
<HorizontalStack Margin="0" Spacing="1" Focusable="false">
- <Image Name="Image" Width="16" Height="16" Path="#go.Images.Icons.radiobutton.svg"/>
+ <Image Name="Image" Width="12" Height="12" Path="#go.Images.Icons.radiobutton.svg"/>
<Label Name="Caption"/>
</HorizontalStack>
\ No newline at end of file diff --git a/Tests/GOLIBTest_4.cs b/Tests/GOLIBTest_4.cs index 141f41d8..8adb5064 100644 --- a/Tests/GOLIBTest_4.cs +++ b/Tests/GOLIBTest_4.cs @@ -150,12 +150,7 @@ namespace test c.Top += e.YDelta;
c.registerForGraphicUpdate ();
}
- protected override void OnRenderFrame (FrameEventArgs e)
- {
- GL.Clear (ClearBufferMask.ColorBufferBit);
- base.OnRenderFrame (e);
- SwapBuffers ();
- }
+
private int frameCpt = 0;
protected override void OnUpdateFrame (FrameEventArgs e)
{
diff --git a/Tests/GOLIBTest_Window.cs b/Tests/GOLIBTest_Window.cs index 56a7712b..4ce0b654 100644 --- a/Tests/GOLIBTest_Window.cs +++ b/Tests/GOLIBTest_Window.cs @@ -18,6 +18,10 @@ namespace test {
class GOLIBTest_Window : OpenTKGameWindow , IValueChange
{
+ #region IValueChange implementation
+ public event EventHandler<ValueChangeEventArgs> ValueChanged;
+ #endregion
+
#region FPS
int _fps = 0;
@@ -64,7 +68,7 @@ namespace test #endregion
public GOLIBTest_Window ()
- : base(600, 400,"test")
+ : base(800, 600,"test")
{}
Window g;
@@ -78,15 +82,10 @@ namespace test // LoadInterface("Interfaces/testWindow.goml", out g);
// LoadInterface("Interfaces/testWindow.goml", out g);
// LoadInterface("Interfaces/testWindow.goml", out g);
-
- }
- protected override void OnRenderFrame (FrameEventArgs e)
- {
- GL.Clear (ClearBufferMask.ColorBufferBit);
- base.OnRenderFrame (e);
- SwapBuffers ();
+ CursorVisible = true;
}
+
private int frameCpt = 0;
protected override void OnUpdateFrame (FrameEventArgs e)
{
@@ -102,11 +101,11 @@ namespace test frameCpt++;
}
- #region IValueChange implementation
-
- public event EventHandler<ValueChangeEventArgs> ValueChanged;
-
- #endregion
+ protected override void OnKeyDown (KeyboardKeyEventArgs e)
+ {
+ base.OnKeyDown (e);
+ this.Quit ();
+ }
[STAThread]
static void Main ()
diff --git a/Tests/GOLIBTest_fps.cs b/Tests/GOLIBTest_fps.cs index 12fdf444..c46efcb2 100644 --- a/Tests/GOLIBTest_fps.cs +++ b/Tests/GOLIBTest_fps.cs @@ -36,9 +36,10 @@ namespace test fpsMin = _fps;
ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin));
}
-
- if (ValueChanged != null)
- ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps));
+
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps));
+ ValueChanged.Raise (this, new ValueChangeEventArgs ("update",
+ this.updateTime.ElapsedMilliseconds.ToString () + " ms"));
}
}
@@ -53,6 +54,8 @@ namespace test }
#endregion
+ public string update = "";
+
string name = "testName";
public string Name {
@@ -66,31 +69,20 @@ namespace test public GOLIBTest_fps ()
: base(600, 400,"test")
- {}
-
- Container g;
- Label labFps, labFpsMin, labFpsMax, labUpdate;
+ {
+ VSync = VSyncMode.Off;
+ }
protected override void OnLoad (EventArgs e)
{
base.OnLoad (e);
- LoadInterface("Interfaces/fps.goml", out g);
+ LoadInterface("Interfaces/fps.goml");
- labFps = g.FindByName ("labFps") as Label;
- labFpsMin = g.FindByName ("labFpsMin") as Label;
- labFpsMax = g.FindByName ("labFpsMax") as Label;
- labUpdate = g.FindByName ("labUpdate") as Label;
//ValueChanged += (object sender, ValueChangeEventArgs vce) => labFps.Text = vce.NewValue.ToString ();
}
- protected override void OnRenderFrame (FrameEventArgs e)
- {
- GL.Clear (ClearBufferMask.ColorBufferBit);
- base.OnRenderFrame (e);
- SwapBuffers ();
- }
private int frameCpt = 0;
protected override void OnUpdateFrame (FrameEventArgs e)
@@ -99,15 +91,10 @@ namespace test fps = (int)RenderFrequency;
- //labFps.Text = fps.ToString();
- //labUpdate.Text = this.updateTime.ElapsedMilliseconds.ToString() + " ms";
if (frameCpt > 200) {
-// labFpsMin.Text = fpsMin.ToString();
-// labFpsMax.Text = fpsMax.ToString();
resetFps ();
frameCpt = 0;
-
}
frameCpt++;
}
diff --git a/Tests/Interfaces/fps.goml b/Tests/Interfaces/fps.goml index 50e69604..151d9905 100755 --- a/Tests/Interfaces/fps.goml +++ b/Tests/Interfaces/fps.goml @@ -1,29 +1,25 @@ <?xml version="1.0"?>
-<Container Name="MainGrp"
-
- Margin="10" Focusable="True" Fit="True">
- <Expandable Width="150" Background="Green" Margin="2">
-<!-- HorizontalAlignment="Right" VerticalAlignment="Bottom"-->
-<!-- <VerticalStack Fit="True" BorderWidth="1" Margin="5" WidgetSpacing="4">-->
-<!-- <HorizontalStack>
- <Label Text="Update:" FontColor="White" VerticalAlignment="Center" />
- <Label Name="labUpdate" Text="xxxx" FontSize="12" Width="60" TextAlignment="Center" Background="DarkGreen"/>
- </HorizontalStack>-->
+<Container Name="MainGrp" Background="0,5;0,5;0,5;0,5"
+ HorizontalAlignment="Left" VerticalAlignment="Top"
+ Margin="10" Width="-1" Height="-1" Focusable="True" >
+
+ <VerticalStack Name="vsFps" BorderWidth="1" Margin="5" Spacing="4">
<HorizontalStack>
- <Label Text="Fps:" Width = "30" VerticalAlignment="Center" TextAlignment="LeftCenter"/>
- <Label Name="labFps" Text="{fps}" Font="droid bold, 12"
- TextAlignment="Center" Background="AoEnglish"/>
+ <Label Text="Update:" FontColor="White" />
+ <Label Name="labUpdate" Text="{update}" FontSize="12" Background="DarkGreen"/>
</HorizontalStack>
-<!-- <HorizontalStack>
+ <HorizontalStack Name="hsFps" Background="Red" >
+ <Label Name="captionFps" Text="Fps:" />
+ <Label Name="valueFps" Text="{fps}" Font="droid bold, 12" TextAlignment="Center" Background="AoEnglish"/>
+ </HorizontalStack>
+ <HorizontalStack Background="Red">
<Label Text="Min:" Width = "30" />
- <Label Name="labFpsMin" Text="{fpsMin}" Font="droid bold, 12"
- TextAlignment="Center" Background="AoEnglish"/>
+ <Label Text="{fpsMin}" Font="droid bold, 12" TextAlignment="Center" Background="AoEnglish"/>
</HorizontalStack>
- <HorizontalStack>
+ <HorizontalStack Background="Red" >
<Label Text="Max:" Width = "30"/>
- <Label Name="labFpsMax" Text="{fpsMax}" Font="droid bold, 12"
- TextAlignment="Center" Background="AoEnglish"/>
- </HorizontalStack>-->
-<!-- </VerticalStack>-->
- </Expandable>
+ <Label Text="{fpsMax}" Font="droid bold, 12" TextAlignment="Center" Background="AoEnglish"/>
+ </HorizontalStack>
+
+ </VerticalStack>
</Container>
\ No newline at end of file diff --git a/Tests/Interfaces/testWindow.goml b/Tests/Interfaces/testWindow.goml index ae9cbc25..dc9dc3dc 100755 --- a/Tests/Interfaces/testWindow.goml +++ b/Tests/Interfaces/testWindow.goml @@ -2,10 +2,10 @@ <!--<Group>-->
<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,5"
Focusable="True">
- <VerticalStack Name="contentVSStack" Height="0" Width="0" Margin="1" Spacing="10">
- <Slider Name="slider" Height="20" Width="0"/>
+ <VerticalStack Name="contentVSStack" Height="0" Width="0" Margin="10" Spacing="10">
+ <Slider Name="slider" Height="10" Width="0"/>
- <HorizontalStack Width="0" Height="-1" Margin="0" Background="Red">
+ <HorizontalStack Width="-1" Height="-1" Margin="0" Background="Red">
<Checkbox Height="-1" Width="-1"/>
<Checkbox Height="-1" Width="-1"/>
</HorizontalStack>
@@ -14,10 +14,6 @@ <RadioButton Caption="Radio 1"/>
<RadioButton Caption="Radio 2" IsChecked="true"/>
<RadioButton Caption="Radio 3"/>
- <RadioButton Caption="Radio 4"/>
- <RadioButton Caption="Radio 5"/>
- <RadioButton Caption="Radio 6"/>
- <RadioButton Caption="Radio 7"/>
</VerticalStack>
</GroupBox>
<!-- <Checkbox Height="-1" Width="-1" Background="Red" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Right"/>-->
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index a85eadf0..3fa1d1d9 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -8,7 +8,7 @@ <OutputType>Exe</OutputType> <RootNamespace>Tests</RootNamespace> <AssemblyName>Tests</AssemblyName> - <StartupObject>test.GOLIBTest_4</StartupObject> + <StartupObject>test.GOLIBTest_Window</StartupObject> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <OutputPath>..\bin\$(configuration)</OutputPath> <IntermediateOutputPath>obj\$(configuration)</IntermediateOutputPath> @@ -40,7 +40,7 @@ <Reference Include="System.Windows.Forms" /> <Reference Include="System.Drawing" /> <Reference Include="OpenTK"> - <HintPath>..\opentk\Binaries\OpenTK\Release\OpenTK.dll</HintPath> + <HintPath>..\..\opentk\Binaries\OpenTK\Release\OpenTK.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index 8c648d0e..07b051d2 100755 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -26,7 +26,7 @@ namespace go // 3,0,OpenTK.Graphics.GraphicsContextFlags.Default)
public OpenTKGameWindow(int _width, int _height, string _title="golib")
: base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 8),
- _title,GameWindowFlags.Default,DisplayDevice.Default,
+ _title,GameWindowFlags.Default,DisplayDevice.GetDisplay(DisplayIndex.Second),
3,2,OpenTK.Graphics.GraphicsContextFlags.Debug|OpenTK.Graphics.GraphicsContextFlags.ForwardCompatible)
// public OpenTKGameWindow(int _width, int _height, string _title="golib")
// : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 8), _title)
@@ -41,7 +41,6 @@ namespace go XCursor.SW = XCursorFile.Load("#go.Images.Icons.Cursors.bottom_left_corner").Cursors[0];
XCursor.SE = XCursorFile.Load("#go.Images.Icons.Cursors.bottom_right_corner").Cursors[0];
-
}
#endregion
@@ -230,6 +229,7 @@ namespace go GraphicObjects.CopyTo (invGOList,0);
invGOList = invGOList.Reverse ().ToArray ();
+ //Debug.WriteLine ("======= Layouting queue start =======");
while (Interface.LayoutingQueue.Count > 0) {
LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
lqi.ProcessLayouting ();
@@ -325,9 +325,14 @@ namespace go return tmp;
}
#endregion
+
public virtual void OnRender(FrameEventArgs e)
{
}
+ public virtual void GLClear()
+ {
+ GL.Clear (ClearBufferMask.ColorBufferBit);
+ }
#region Game win overrides
protected override void OnUpdateFrame(FrameEventArgs e)
{
@@ -336,12 +341,14 @@ namespace go }
protected override void OnRenderFrame(FrameEventArgs e)
{
- GL.Clear (ClearBufferMask.ColorBufferBit);
+ GLClear ();
+
base.OnRenderFrame(e);
- OpenGLDraw ();
OnRender (e);
+ OpenGLDraw ();
+
SwapBuffers ();
}
|