Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I know the post is old but! If you're still interested, here's my take on the subject:</p> <p>The <code>Surface</code> objects returned by the <code>Video.SetVideoMode()</code> method and the <code>Video.Screen</code> property are not equal but they both use the same Handle, which is the pointer to the graphical data. I would say it's mostly a matter of style, both are valid ways to work on your main display surface.</p> <ul> <li><p><code>Video.SetVideoMode()</code> leads to the following in Video.cs:</p> <pre><code>public static Surface SetVideoMode(int width, int height, int bitsPerPixel, bool resizable, bool openGL, bool fullScreen, bool hardwareSurface, bool frame) { /* ... */ return new Surface(Sdl.SDL_SetVideoMode(width, height, bitsPerPixel, (int)flags), true); } </code></pre> <p>... calling the following internal constructor in Surface.cs:</p> <pre><code>internal Surface(IntPtr handle, bool isVideoMode) { this.Handle = handle; this.isVideoMode = isVideoMode; } </code></pre></li> <li><p>Alternatively, this is the <code>Video.Screen</code> property definition in Video.cs:</p> <pre><code>/// &lt;summary&gt; /// Gets the surface for the window or screen, /// must be preceded by a call to SetVideoMode /// &lt;/summary&gt; /// &lt;returns&gt;The main screen surface&lt;/returns&gt; public static Surface Screen { get { return Surface.FromScreenPtr(Sdl.SDL_GetVideoSurface()); } } </code></pre> <p>... calling the following internal factory method in Surface.cs:</p> <pre><code>internal static Surface FromScreenPtr(IntPtr surfacePtr) { return new Surface(surfacePtr); } </code></pre> <p>... in turn calling the following internal constructor in Surface.cs:</p> <pre><code>internal Surface(IntPtr handle) { this.Handle = handle; } </code></pre></li> </ul> <p>If you compare the Handles of the <code>Surface</code> objects returned by <code>Video.SetVideoMode()</code> and <code>Video.Screen</code>, you will see that they are equal, which is all you need to know to make sure that you are actually working with the same data.</p> <p>Hope this helps!</p> <p>Sources:</p> <p><a href="https://www.assembla.com/code/lightcs/subversion/nodes/trunk/sdldotnet-6.1.0/source/src/Graphics/Video.cs?rev=4" rel="nofollow">https://www.assembla.com/code/lightcs/subversion/nodes/trunk/sdldotnet-6.1.0/source/src/Graphics/Video.cs?rev=4</a></p> <p><a href="https://www.assembla.com/code/lightcs/subversion/nodes/trunk/sdldotnet-6.1.0/source/src/Graphics/Surface.cs?rev=4" rel="nofollow">https://www.assembla.com/code/lightcs/subversion/nodes/trunk/sdldotnet-6.1.0/source/src/Graphics/Surface.cs?rev=4</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload