Renamed WindowSettings to ContextSettings in SFML.Net

Removed the Window.Events property in SFML.Net
FS#124 - Fix KeyEvent.Alt/Control/Shift members not working, in SFML.Net

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1179 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-07-17 07:57:28 +00:00
parent 07c0318493
commit 34817446c0
6 changed files with 32 additions and 51 deletions

View File

@ -25,7 +25,7 @@ namespace SFML
/// <param name="title">Title of the window</param>
////////////////////////////////////////////////////////////
public RenderWindow(VideoMode mode, string title) :
this(mode, title, Styles.Resize | Styles.Close, new WindowSettings(24, 8, 0))
this(mode, title, Styles.Resize | Styles.Close, new ContextSettings(24, 8, 0))
{
}
@ -38,7 +38,7 @@ namespace SFML
/// <param name="style">Window style (Resize | Close by default)</param>
////////////////////////////////////////////////////////////
public RenderWindow(VideoMode mode, string title, Styles style) :
this(mode, title, style, new WindowSettings(24, 8, 0))
this(mode, title, style, new ContextSettings(24, 8, 0))
{
}
@ -51,7 +51,7 @@ namespace SFML
/// <param name="style">Window style (Resize | Close by default)</param>
/// <param name="settings">Creation parameters</param>
////////////////////////////////////////////////////////////
public RenderWindow(VideoMode mode, string title, Styles style, WindowSettings settings) :
public RenderWindow(VideoMode mode, string title, Styles style, ContextSettings settings) :
base(sfRenderWindow_Create(mode, title, style, settings), 0)
{
Initialize();
@ -64,7 +64,7 @@ namespace SFML
/// <param name="handle">Platform-specific handle of the control</param>
////////////////////////////////////////////////////////////
public RenderWindow(IntPtr handle) :
this(handle, new WindowSettings(24, 8, 0))
this(handle, new ContextSettings(24, 8, 0))
{
}
@ -75,7 +75,7 @@ namespace SFML
/// <param name="handle">Platform-specific handle of the control</param>
/// <param name="settings">Creation parameters</param>
////////////////////////////////////////////////////////////
public RenderWindow(IntPtr handle, WindowSettings settings) :
public RenderWindow(IntPtr handle, ContextSettings settings) :
base(sfRenderWindow_CreateFromHandle(handle, settings), 0)
{
Initialize();
@ -141,7 +141,7 @@ namespace SFML
/// Creation settings of the window
/// </summary>
////////////////////////////////////////////////////////////
public override WindowSettings Settings
public override ContextSettings Settings
{
get {return sfRenderWindow_GetSettings(This);}
}
@ -460,10 +460,10 @@ namespace SFML
#region Imports
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfRenderWindow_Create(VideoMode Mode, string Title, Styles Style, WindowSettings Params);
static extern IntPtr sfRenderWindow_Create(VideoMode Mode, string Title, Styles Style, ContextSettings Params);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfRenderWindow_CreateFromHandle(IntPtr Handle, WindowSettings Params);
static extern IntPtr sfRenderWindow_CreateFromHandle(IntPtr Handle, ContextSettings Params);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfRenderWindow_Destroy(IntPtr This);
@ -496,7 +496,7 @@ namespace SFML
static extern uint sfRenderWindow_GetHeight(IntPtr This);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern WindowSettings sfRenderWindow_GetSettings(IntPtr This);
static extern ContextSettings sfRenderWindow_GetSettings(IntPtr This);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfRenderWindow_UseVerticalSync(IntPtr This, bool Enable);

View File

@ -7,11 +7,11 @@ namespace SFML
{
////////////////////////////////////////////////////////////
/// <summary>
/// Structure defining the creation settings of windows
/// Structure defining the creation settings of OpenGL contexts
/// </summary>
////////////////////////////////////////////////////////////
[StructLayout(LayoutKind.Sequential)]
public struct WindowSettings
public struct ContextSettings
{
////////////////////////////////////////////////////////////
/// <summary>
@ -20,7 +20,7 @@ namespace SFML
/// <param name="depthBits">Depth buffer bits</param>
/// <param name="stencilBits">Stencil buffer bits</param>
////////////////////////////////////////////////////////////
public WindowSettings(uint depthBits, uint stencilBits) :
public ContextSettings(uint depthBits, uint stencilBits) :
this(depthBits, stencilBits, 0)
{
}
@ -33,7 +33,7 @@ namespace SFML
/// <param name="stencilBits">Stencil buffer bits</param>
/// <param name="antialiasingLevel">Antialiasing level</param>
////////////////////////////////////////////////////////////
public WindowSettings(uint depthBits, uint stencilBits, uint antialiasingLevel)
public ContextSettings(uint depthBits, uint stencilBits, uint antialiasingLevel)
{
DepthBits = depthBits;
StencilBits = stencilBits;

View File

@ -234,13 +234,13 @@ namespace SFML
public KeyCode Code;
/// <summary>Is the Alt modifier pressed?</summary>
public bool Alt;
public int Alt;
/// <summary>Is the Control modifier pressed?</summary>
public bool Control;
public int Control;
/// <summary>Is the Shift modifier pressed?</summary>
public bool Shift;
public int Shift;
}
////////////////////////////////////////////////////////////

View File

@ -20,9 +20,9 @@ namespace SFML
public KeyEventArgs(KeyEvent e)
{
Code = e.Code;
Alt = e.Alt;
Control = e.Control;
Shift = e.Shift;
Alt = e.Alt != 0;
Control = e.Control != 0;
Shift = e.Shift != 0;
}
/// <summary>Code of the key (see KeyCode enum)</summary>

View File

@ -47,7 +47,7 @@ namespace SFML
/// <param name="title">Title of the window</param>
////////////////////////////////////////////////////////////
public Window(VideoMode mode, string title) :
this(mode, title, Styles.Resize | Styles.Close, new WindowSettings(24, 8, 0))
this(mode, title, Styles.Resize | Styles.Close, new ContextSettings(24, 8, 0))
{
}
@ -60,7 +60,7 @@ namespace SFML
/// <param name="style">Window style (Resize | Close by default)</param>
////////////////////////////////////////////////////////////
public Window(VideoMode mode, string title, Styles style) :
this(mode, title, style, new WindowSettings(24, 8, 0))
this(mode, title, style, new ContextSettings(24, 8, 0))
{
}
@ -73,7 +73,7 @@ namespace SFML
/// <param name="style">Window style (Resize | Close by default)</param>
/// <param name="settings">Creation parameters</param>
////////////////////////////////////////////////////////////
public Window(VideoMode mode, string title, Styles style, WindowSettings settings) :
public Window(VideoMode mode, string title, Styles style, ContextSettings settings) :
base(sfWindow_Create(mode, title, style, settings))
{
myInput = new Input(sfWindow_GetInput(This));
@ -86,7 +86,7 @@ namespace SFML
/// <param name="handle">Platform-specific handle of the control</param>
////////////////////////////////////////////////////////////
public Window(IntPtr handle) :
this(handle, new WindowSettings(24, 8, 0))
this(handle, new ContextSettings(24, 8, 0))
{
}
@ -97,31 +97,12 @@ namespace SFML
/// <param name="Handle">Platform-specific handle of the control</param>
/// <param name="settings">Creation parameters</param>
////////////////////////////////////////////////////////////
public Window(IntPtr Handle, WindowSettings settings) :
public Window(IntPtr Handle, ContextSettings settings) :
base(sfWindow_CreateFromHandle(Handle, settings))
{
myInput = new Input(sfWindow_GetInput(This));
}
////////////////////////////////////////////////////////////
/// <summary>
/// Return the list of window's events which happened since last call
/// </summary>
/// <returns>Array of events</returns>
////////////////////////////////////////////////////////////
public Event[] Events
{
get
{
Event Evt;
List<Event> Evts = new List<Event>();
while (GetEvent(out Evt))
Evts.Add(Evt);
return Evts.ToArray();
}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Input manager of the window
@ -192,7 +173,7 @@ namespace SFML
/// Creation settings of the window
/// </summary>
////////////////////////////////////////////////////////////
public virtual WindowSettings Settings
public virtual ContextSettings Settings
{
get { return sfWindow_GetSettings(This); }
}
@ -360,12 +341,12 @@ namespace SFML
////////////////////////////////////////////////////////////
/// <summary>
/// Call the event handlers for each pending event.
/// Use of this function is exclusive with the Events property (use one or the other)
/// </summary>
////////////////////////////////////////////////////////////
public void DispatchEvents()
{
foreach (Event e in Events)
Event e;
while (GetEvent(out e))
{
switch (e.Type)
{
@ -540,10 +521,10 @@ namespace SFML
#region Imports
[DllImport("csfml-window"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfWindow_Create(VideoMode Mode, string Title, Styles Style, WindowSettings Params);
static extern IntPtr sfWindow_Create(VideoMode Mode, string Title, Styles Style, ContextSettings Params);
[DllImport("csfml-window"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfWindow_CreateFromHandle(IntPtr Handle, WindowSettings Params);
static extern IntPtr sfWindow_CreateFromHandle(IntPtr Handle, ContextSettings Params);
[DllImport("csfml-window"), SuppressUnmanagedCodeSecurity]
static extern void sfWindow_Destroy(IntPtr This);
@ -570,7 +551,7 @@ namespace SFML
static extern uint sfWindow_GetHeight(IntPtr This);
[DllImport("csfml-window"), SuppressUnmanagedCodeSecurity]
static extern WindowSettings sfWindow_GetSettings(IntPtr This);
static extern ContextSettings sfWindow_GetSettings(IntPtr This);
[DllImport("csfml-window"), SuppressUnmanagedCodeSecurity]
static extern void sfWindow_UseVerticalSync(IntPtr This, bool Enable);

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}</ProjectGuid>
<OutputType>Library</OutputType>
@ -48,6 +48,7 @@
</Target>
-->
<ItemGroup>
<Compile Include="ContextSettings.cs" />
<Compile Include="Event.cs" />
<Compile Include="EventArgs.cs" />
<Compile Include="Input.cs" />
@ -55,7 +56,6 @@
<Compile Include="ObjectBase.cs" />
<Compile Include="VideoMode.cs" />
<Compile Include="Window.cs" />
<Compile Include="WindowSettings.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />