XNA - Showing a texture without a window? - c#

I wanted to know whether it's possible to show a 2D Texture in XNA without a window that contains it. Just like drawing a picture/texture (maybe with the SpriteBatch.draw()-method?) simply onto the screen, independent from a seperated window. (What comes to my mind here is the Photoshop-opening window)
Is this possible in XNA? I can't find anything like this for SpriteBatch. Do I have to write totally new code/method?

If you mean splash image, it might be drawn from another application before launch (aka launcher) or you can show border-less window with image while loading application content in background.
Unfortunately XNA does not support border-less window, however there is walk-around using windows forms: https://gamedev.stackexchange.com/questions/37109/is-there-a-simpler-way-to-create-a-borderless-window-with-xna-4-0
If you will be able to create borderless window with XNA, then you need to change window size in constructor to splash image size, and draw same size image while loading content.
I would not recommend displaying splash image as it serves no real purpose, if you want to display some logo while starting the game - simply start game in fullscrean and draw image on black background while loading content, this is the way all modern games does it.

Related

Fullscreen Form with a maximum form size lagging

I'm making a game, and all of the pictureboxes sizes and locations are based on an 1920x1080 resolution (as that is my screen size). But when the game is played on a different resolution, the game doesn't fullscreen, (using FormBorderStyle = FormBorderStyle.None; and WindowState = FormWindowState.Maximized;), because I have set the maximum form size as 1920x1080. The problem is, that when the game is played on a bigger resolution monitor and the form doesn't fill up the entire screen, the game gets extremely laggy and slow. Is there any way to fix this? Perhaps by adding black bars around the game?
Assuming your game depends on the Screen and the Window being that exact size to work properly, you could move the entire game into a UI Panel, and center that in the window. This would probably require a lot of reworking of your code.
Or you could go the lazy way of opening open a new Window instead of the game from your Program.cs that is entirely black and maximize that, and then open the Game-Window Center-Screen at 1920x1080 without maximizing it as a Dialog from the background window, so it is always in front of the black one.

Render OpenGL scene at two different locations

I am writing an application that renders an OpenGL scene. This application has two windows:
A large window that shows only the rendered scene
A "control window" that offers several settings and a preview of the rendered scene
This application is written in .NET (for the control window part) and uses a native C++ DLL to create the rendering window and do the actual OpenGL rendering.
This works fine, but one important part is still missing: getting a live preview of the rendered scene into my .NET control window.
So far I could think of two solutions:
Render the scene not only to the screen, but also to memory. Then shove that blob of memory to my .NET WinForm. Finally draw the image to a PictureBox or something. <- This sounds horribly slow!
Make my native OpenGL renderer render the scene twice, once to the native full size window, once to a control (panel?) on my .NET form.
Option 2 sounds faster, but I have no idea if/how that even works.
Can this be done? Are there better alternatives?
Look into the documentation on framebuffers. It is basically the destination of your rendering, by default it's your viewport (or the backbuffer, which switches with the displayed buffer once it's ready).
The first option should generally be faster as you render the scene once and then just basically copy a texture.

Prolonging Unity Splash screen (Android)

I'm making a little game in Unity 5.3 and i want the splash screen to last longer. Is there a way to do this without adding a second scene with the splash screen image?
I dont think it is possible to customize the length of the splash screen display, but some options exist for it. Take a look at these links and you can see what is possible to customize.
http://docs.unity3d.com/Manual/class-PlayerSettingsAndroid.html
http://docs.unity3d.com/Manual/MobileCustomizeSplashScreen.html

Complete interaction through a form using C#

I am making an overlay program with C# that will have an overlay for games. I am currently using a borderless form with a transparent background and a picture box to draw pictures to the screen, but I can't click the window behind the form. I have set the form to be always on top so that I can play games and the UI stays, but every time the mouse goes over the form in the game if I click the focused window switches to my form, preventing game interaction.
I have tried using functions to just draw images to the screen without using forms, but I cannot work out how to do that.
All I want is things like an external menu/crosshair and such, for use in minecraft. As for the menu, I could make my own media controls and such, and the crosshair would be useful because I hate the default crosshair. I could draw shapes to the screen, but if I don't use pictures the crosshair might look tacky.
A possible solution is a per pixel alpha blending window.
Here is a good starting point: Per Pixel Alpha Blend in C#
The example source code should give you the idea.
Hope this helps

How can I show a grey transparent overlay in C#?

How can I show a grey transparent overlay in C#?
It should overlay other process which are not owned by the application doing the overlay.
Create a transparent window the size of the whole screen, mark it always-on-top, calculate the regions of your other application windows, and make the non-window regions of the top window grey.
I suppose you could just position your own application windows on top of the transparent grey one, with it being above all the other ones, but getting a tricky z-order scenario like that right, especially in conjunction with other apps that might also be doing z-order tricks, is tough.
Here a little app which do more or less the functionnality you want :
http://www.anappaday.com/downloads/2006/09/day-10-jedi-concentrate.html

Categories

Resources