mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 07:41:05 +08:00
Added missing VideoMode functions to SFML.Net
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1073 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
93e3db2668
commit
c96a931ede
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
@ -42,6 +43,51 @@ namespace SFML
|
||||
BitsPerPixel = bpp;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Tell whether or not the video mode is supported
|
||||
/// </summary>
|
||||
/// <returns>True if the video mode is valid, false otherwise</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public bool IsValid()
|
||||
{
|
||||
return sfVideoMode_IsValid(this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get the number of valid video modes
|
||||
/// <summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public static uint ModesCount
|
||||
{
|
||||
get {return sfVideoMode_GetModesCount();}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get a valid video mode.
|
||||
/// Index must be in range [0, ModesCount[.
|
||||
/// Modes are sorted from best to worst
|
||||
/// </summary>
|
||||
/// <param name="index">Index of the video mode to get</param>
|
||||
/// <returns>index-th video mode</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public static VideoMode GetMode(uint index)
|
||||
{
|
||||
return sfVideoMode_GetMode(index);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get the current desktop video mode
|
||||
/// <summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public static VideoMode DesktopMode
|
||||
{
|
||||
get {return sfVideoMode_GetDesktopMode();}
|
||||
}
|
||||
|
||||
/// <summary>Video mode width, in pixels</summary>
|
||||
public uint Width;
|
||||
|
||||
@ -50,6 +96,20 @@ namespace SFML
|
||||
|
||||
/// <summary>Video mode depth, in bits per pixel</summary>
|
||||
public uint BitsPerPixel;
|
||||
|
||||
#region Imports
|
||||
[DllImport("csfml-window"), SuppressUnmanagedCodeSecurity]
|
||||
static extern VideoMode sfVideoMode_GetDesktopMode();
|
||||
|
||||
[DllImport("csfml-window"), SuppressUnmanagedCodeSecurity]
|
||||
static extern uint sfVideoMode_GetModesCount();
|
||||
|
||||
[DllImport("csfml-window"), SuppressUnmanagedCodeSecurity]
|
||||
static extern VideoMode sfVideoMode_GetMode(uint Index);
|
||||
|
||||
[DllImport("csfml-window"), SuppressUnmanagedCodeSecurity]
|
||||
static extern bool sfVideoMode_IsValid(VideoMode Mode);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user