<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<DefineConstants>DEBUG;TRACE</DefineConstants>
+ <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
+ <OutputPath>$(SolutionDir)build\$(Configuration)</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<WarningLevel>0</WarningLevel>
<ConsolePause>false</ConsolePause>
+ <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
+ <OutputPath>$(SolutionDir)build\$(Configuration)</OutputPath>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
+ <StartAction>Program</StartAction>
+ <StartProgram>%24{TargetName}</StartProgram>
+ <StartWorkingDirectory>%24{SolutionDir}\build\%24{ProjectConfigName}</StartWorkingDirectory>
+ <ConsolePause>false</ConsolePause>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<None Include="OpenTK.dll.config" />
- <None Include="packages.config" />
<None Include="ui\icons\center-align.svg" />
<None Include="ui\icons\cogwheel.svg" />
<None Include="ui\icons\edit.svg" />
<None Include="ui\icons\zoom-in.svg" />
<None Include="ui\icons\zoom-out.svg" />
<None Include="ui\icons\basic_floppydisk.svg" />
- <None Include="Crow.dll.config" />
+ <None Include="packages.config" />
+ <None Include="Crow.dll.config">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<HintPath>packages\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="Crow">
- <HintPath>packages\Crow.OpenTK.0.5.6\lib\net45\Crow.dll</HintPath>
+ <HintPath>packages\Crow.OpenTK.0.6.0\lib\net45\Crow.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CodeBufferEventArgs.cs" />
<Compile Include="src\Node.cs" />
<Compile Include="CrowWindow.cs" />
- <Compile Include="InterfaceControler.cs" />
- <Compile Include="OpenGL\Extensions.cs" />
- <Compile Include="OpenGL\Shader.cs" />
- <Compile Include="OpenGL\Texture.cs" />
- <Compile Include="OpenGL\vaoMesh.cs" />
<Compile Include="src\CodeLine.cs" />
+ <Compile Include="OpenGL\vaoMesh.cs" />
+ <Compile Include="OpenGL\Texture.cs" />
+ <Compile Include="OpenGL\Shader.cs" />
+ <Compile Include="OpenGL\Extensions.cs" />
+ <Compile Include="InterfaceControler.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="ui\" />
ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin));
}
#endif
- if (frameCpt % 20 == 0) {
+ if (frameCpt % 3 == 0) {
ValueChanged.Raise (this, new ValueChangeEventArgs ("fps", _fps));
#if MEASURE_TIME
foreach (PerformanceMeasure m in ifaceControl[0].PerfMeasures)
public List<InterfaceControler> ifaceControl = new List<InterfaceControler>();
int focusedIdx = -1, activeIdx = -2;
+ // TODO:We should be able to set the current interface programmaticaly
+ /// <summary>
+ /// Gets the currently focused interface, focus could have been given by creation of new iface controler and
+ /// not only by the mouse
+ /// </summary>
+ public Interface CurrentInterface {
+ get {
+ if (ifaceControl.Count == 0) {//create default orthogonal interface
+ addInterfaceControler (new InterfaceControler (
+ new Rectangle (0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height)));
+ focusedIdx = 0;
+ }
+ return ifaceControl [focusedIdx].CrowInterface;
+ }
+ }
+
void addInterfaceControler(InterfaceControler ifaceControler)
{
ifaceControler.CrowInterface.Quit += Quit;
ifaceControler.CrowInterface.MouseCursorChanged += CrowInterface_MouseCursorChanged;
ifaceControl.Add (ifaceControler);
+ focusedIdx = ifaceControl.Count - 1;
}
void openGLDraw(){
//save GL states
#region Events
//those events are raised only if mouse isn't in a graphic object
- public event EventHandler<OpenTK.Input.MouseWheelEventArgs> MouseWheelChanged;
- public event EventHandler<OpenTK.Input.MouseButtonEventArgs> MouseButtonUp;
- public event EventHandler<OpenTK.Input.MouseButtonEventArgs> MouseButtonDown;
- public event EventHandler<OpenTK.Input.MouseButtonEventArgs> MouseClick;
- public event EventHandler<OpenTK.Input.MouseMoveEventArgs> MouseMove;
- public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> KeyboardKeyDown;
- public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> KeyboardKeyUp;
+ public event EventHandler<OpenTK.Input.MouseWheelEventArgs> CrowMouseWheel;
+ public event EventHandler<OpenTK.Input.MouseButtonEventArgs> CrowMouseUp;
+ public event EventHandler<OpenTK.Input.MouseButtonEventArgs> CrowMouseDown;
+ public event EventHandler<OpenTK.Input.MouseButtonEventArgs> CrowMouseClick;
+ public event EventHandler<OpenTK.Input.MouseMoveEventArgs> CrowMouseMove;
+ public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> CrowKeyDown;
+ public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> CrowKeyUp;
#endregion
ifaceControl [interfaceIdx].CrowInterface.AddWidget (g);
return g;
}
+
public void DeleteWidget (GraphicObject g, int interfaceIdx = 0){
ifaceControl [interfaceIdx].CrowInterface.DeleteWidget (g);
}
- public GraphicObject Load (string path, int interfaceIdx = 0){
+ /// <summary>
+ /// check if a default interface exists, create one if not
+ /// </summary>
+ void checkDefaultIFace (){
if (ifaceControl.Count == 0)//create default orthogonal interface
addInterfaceControler (new InterfaceControler (
- new Rectangle (0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height)));
- return ifaceControl [interfaceIdx].CrowInterface.LoadInterface (path);
+ new Rectangle (0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height)));
}
+ /// <summary>
+ /// Load the content of the IML file pointed by path and add it to the current interface
+ /// graphic tree.
+ /// </summary>
+ /// <param name="path">the path of the IML file to load</param>
+ /// <param name="interfaceIdx">interface index to bind to, a default one is created if none exists</param>
+ public GraphicObject Load (string path, int interfaceIdx = 0){
+ checkDefaultIFace();
+ return ifaceControl [interfaceIdx].CrowInterface.AddWidget (path);
+ }
+ /// <summary>
+ /// Load the content of the IML string passed as first argument and add it to the current interface
+ /// graphic tree.
+ /// </summary>
+ /// <param name="path">a valid IML string</param>
+ /// <param name="interfaceIdx">interface index to bind to, a default one is created if none exists</param>
+ public void LoadIMLFragment (string imlFragment, int interfaceIdx = 0){
+ checkDefaultIFace();
+ ifaceControl [interfaceIdx].CrowInterface.LoadIMLFragment (imlFragment);
+ }
+
public GraphicObject FindByName (string nameToFind){
for (int i = 0; i < ifaceControl.Count; i++) {
GraphicObject tmp = ifaceControl [i].CrowInterface.FindByName (nameToFind);
base.OnLoad(e);
this.KeyPress += new EventHandler<OpenTK.KeyPressEventArgs>(OpenTKGameWindow_KeyPress);
- Keyboard.KeyDown += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyDown);
- Keyboard.KeyUp += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyUp);
- Mouse.WheelChanged += new EventHandler<OpenTK.Input.MouseWheelEventArgs>(GL_Mouse_WheelChanged);
- Mouse.ButtonDown += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(GL_Mouse_ButtonDown);
- Mouse.ButtonUp += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(GL_Mouse_ButtonUp);
- Mouse.Move += new EventHandler<OpenTK.Input.MouseMoveEventArgs>(GL_Mouse_Move);
+ KeyDown += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyDown);
+ KeyUp += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyUp);
+
+ MouseWheel += new EventHandler<OpenTK.Input.MouseWheelEventArgs>(GL_Mouse_WheelChanged);
+ MouseDown += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(GL_Mouse_ButtonDown);
+ MouseUp += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(GL_Mouse_ButtonUp);
+ MouseMove += new EventHandler<OpenTK.Input.MouseMoveEventArgs>(GL_Mouse_Move);
#if DEBUG
Console.WriteLine("\n\n*************************************");
return;
}
if (focusedIdx < 0)
- MouseMove.Raise (sender, otk_e);
+ CrowMouseMove.Raise (sender, otk_e);
}
protected virtual void GL_Mouse_ButtonUp(object sender, OpenTK.Input.MouseButtonEventArgs otk_e)
{
if (ifaceControl [focusedIdx].ProcessMouseButtonUp ((int)otk_e.Button))
return;
}
- MouseButtonUp.Raise (sender, otk_e);
+ CrowMouseUp.Raise (sender, otk_e);
}
protected virtual void GL_Mouse_ButtonDown(object sender, OpenTK.Input.MouseButtonEventArgs otk_e)
{
if (ifaceControl [focusedIdx].ProcessMouseButtonDown ((int)otk_e.Button))
return;
}
- MouseButtonDown.Raise (sender, otk_e);
+ CrowMouseDown.Raise (sender, otk_e);
}
protected virtual void GL_Mouse_WheelChanged(object sender, OpenTK.Input.MouseWheelEventArgs otk_e)
{
if (ifaceControl [focusedIdx].ProcessMouseWheelChanged (otk_e.DeltaPrecise))
return;
}
- MouseWheelChanged.Raise (sender, otk_e);
+ CrowMouseWheel.Raise (sender, otk_e);
}
protected virtual void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs otk_e)
if (ifaceControl [focusedIdx].ProcessKeyDown((int)otk_e.Key))
return;
}
- KeyboardKeyDown.Raise (this, otk_e);
+ CrowKeyDown.Raise (this, otk_e);
}
protected virtual void Keyboard_KeyUp(object sender, OpenTK.Input.KeyboardKeyEventArgs otk_e)
{
if (ifaceControl [focusedIdx].ProcessKeyUp((int)otk_e.Key))
return;
}
- KeyboardKeyUp.Raise (this, otk_e);
+ CrowKeyUp.Raise (this, otk_e);
}
protected virtual void OpenTKGameWindow_KeyPress (object sender, OpenTK.KeyPressEventArgs e)
{
--- /dev/null
+<configuration>
+ <dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
+ <dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
+ <dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
+ <dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
+ <dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
+ <dllmap os="linux" dll="libX11" target="libX11.so.6"/>
+ <dllmap os="linux" dll="libXi" target="libXi.so.6"/>
+ <dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
+ <dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
+ <dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
+ <dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
+ <dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
+ <dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
+ <dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
+ <dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
+ <dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
+ <!-- XQuartz compatibility (X11 on Mac) -->
+ <dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
+ <dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
+ <dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
+ <dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
+ <dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
+ <dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
+</configuration>