hack around crash in glfw with events before we're done with setup
This commit is contained in:
@@ -166,7 +166,6 @@
|
|||||||
<Compile Include="Graphics\SheetBuilder.cs" />
|
<Compile Include="Graphics\SheetBuilder.cs" />
|
||||||
<Compile Include="Graphics\HardwarePalette.cs" />
|
<Compile Include="Graphics\HardwarePalette.cs" />
|
||||||
<Compile Include="MainWindow.cs">
|
<Compile Include="MainWindow.cs">
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Support\Program.cs" />
|
<Compile Include="Support\Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ namespace OpenRa.GlRenderer
|
|||||||
{
|
{
|
||||||
Glfw.glfwInit();
|
Glfw.glfwInit();
|
||||||
Glfw.glfwOpenWindow(width, height, 0, 0, 0, 0, 0, 0, /*fullscreen ? Glfw.GLFW_FULLSCREEN :*/ Glfw.GLFW_WINDOW);
|
Glfw.glfwOpenWindow(width, height, 0, 0, 0, 0, 0, 0, /*fullscreen ? Glfw.GLFW_FULLSCREEN :*/ Glfw.GLFW_WINDOW);
|
||||||
|
Glfw.glfwSetWindowTitle("OpenRA (OpenGL version)");
|
||||||
|
bool initDone = false;
|
||||||
Glfw.glfwSetMouseButtonCallback( mouseButtonCallback = ( button, action ) =>
|
Glfw.glfwSetMouseButtonCallback( mouseButtonCallback = ( button, action ) =>
|
||||||
{
|
{
|
||||||
var b = button == Glfw.GLFW_MOUSE_BUTTON_1 ? MouseButtons.Left
|
var b = button == Glfw.GLFW_MOUSE_BUTTON_1 ? MouseButtons.Left
|
||||||
@@ -65,17 +67,18 @@ namespace OpenRa.GlRenderer
|
|||||||
Game.DispatchMouseInput( action == Glfw.GLFW_PRESS ? MouseInputEvent.Down : MouseInputEvent.Up,
|
Game.DispatchMouseInput( action == Glfw.GLFW_PRESS ? MouseInputEvent.Down : MouseInputEvent.Up,
|
||||||
new MouseEventArgs( b, action == Glfw.GLFW_PRESS ? 1 : 0, mouseX, mouseY, 0 ), 0 );
|
new MouseEventArgs( b, action == Glfw.GLFW_PRESS ? 1 : 0, mouseX, mouseY, 0 ), 0 );
|
||||||
} );
|
} );
|
||||||
//Glfw.glfwSetMousePosCallback( mousePositionCallback = ( x, y ) =>
|
Glfw.glfwSetMousePosCallback(mousePositionCallback = (x, y) =>
|
||||||
// {
|
{
|
||||||
// mouseX = x;
|
mouseX = x;
|
||||||
// mouseY = y;
|
mouseY = y;
|
||||||
// Game.DispatchMouseInput( MouseInputEvent.Move, new MouseEventArgs( 0, 0, x, y, 0 ), 0 );
|
if (initDone)
|
||||||
// } );
|
Game.DispatchMouseInput(MouseInputEvent.Move, new MouseEventArgs(0, 0, x, y, 0), 0);
|
||||||
|
});
|
||||||
Glfw.glfwSetWindowCloseCallback( windowCloseCallback = () =>
|
Glfw.glfwSetWindowCloseCallback( windowCloseCallback = () =>
|
||||||
{
|
{
|
||||||
Game.Exit();
|
Game.Exit();
|
||||||
Glfw.glfwIconifyWindow();
|
Glfw.glfwIconifyWindow();
|
||||||
return Gl.GL_FALSE;
|
return Gl.GL_TRUE;
|
||||||
} );
|
} );
|
||||||
CheckGlError();
|
CheckGlError();
|
||||||
|
|
||||||
@@ -93,6 +96,8 @@ namespace OpenRa.GlRenderer
|
|||||||
CheckGlError();
|
CheckGlError();
|
||||||
Gl.glEnableClientState( Gl.GL_TEXTURE_COORD_ARRAY );
|
Gl.glEnableClientState( Gl.GL_TEXTURE_COORD_ARRAY );
|
||||||
CheckGlError();
|
CheckGlError();
|
||||||
|
|
||||||
|
initDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Cg.CGerrorCallbackFuncDelegate CgErrorCallback = () =>
|
static Cg.CGerrorCallbackFuncDelegate CgErrorCallback = () =>
|
||||||
|
|||||||
Reference in New Issue
Block a user