I'm building a game in XNA 4.0 and C# and am running into an issue when I try to make the game run fullscreen or when I minimize the window and bring it back. Basically, one of the objects in my game (the doors), always vanish and do not come back.
Does anyone know what exactly happens when the window is minimized and why the door may be behaving differently than other elements in the game?
Check the update and draw loops and make sure your doors are being both updated and redrawn.
When you change the size of the window and objects disappear, there is usually an error somewhere with the redrawing of the frame.
I solved this problem and it was very tricky. What happened had to do with window resizing, as I was using 1366 x 768 when my computer's monitor is only 1280 x 800. Naturally, some of the game is always clipped, but on minimizing, the clipping changed very subtley.
The best fix was to just start putting elements within my own screen resolution. I'm now coding assuming a resolution of 1280 x 768.
Related
I couldn't find an option to send a picture to better explain what's happening. Here's a Unity Link that has the photos to explain the issue.
I've tried Camera.main.orthographicsize = 4.0f, a solid number to stay on but the Orthographic Size of the camera keeps changing it's size after resizing the window when I'm in free aspect Unity editor mode and even when I export the Unity game with 1920x1080(16:9) resolution. I want it to stay the same size when resizing the window so that the game can always fit inside the screen in any resolution when resizing the window. The default blue background of the camera displays when I stretch the window's width far enough which I don't want to happen.
This Youtube video has the results I'm looking for but the code unfortunately is not working on Unity 2019. The code provided from this video does entirely different things for me and doesn't solve my issue.
From what I understood is that the screen has to has a fixed resolution.
This link will demonstrate the solution. https://docs.unity3d.com/Manual/GameView.html
It does that by changing the
Game View Aspect from free to a fixed resolution.
Unless this is not what you are looking for then I sugest another solution:
Make a black background image that fits the screen size.
Then change the scale of the objects in the scene relative to the camera.
This link will make the scaling solution, Make object visual size constant despite the distance
I want the game to adapt to the screen resolution, but I want the viewport to always stay the same, so the game basically just resizes itself when running on different PCs. How do I do it?
So, for example, screen resolution is 1920x1080 and the viewport is 640x480. How do I stretch those 640x480 onto 1920x1080? Is that even possible?
If this did not make any sense, I'll try to explain another way.
Thanks in advance!
I am trying to code custom cursor graphics for Windows 8. I will use it for an application which uses one or any number of Wiimotes to send touch input to Windows, which means I need to be able to display several cursors. I can not use the build in cursor for touch because they are very hard to see when it is viewed from a distance.
Currently I am using a separate transparent window for each cursor on which I draw the cursor graphics with DirectX, but for the actual re-positioning of the cursor I move the window to the current cursor position by using the win32 methods SendMessage and SetWindowPos. This will result in a near zero latency for re-positioning, but it will use unreasonable amount of process time. Sometimes near 30% when moving several cursors at the same time.
What I initially tried was drawing to a transparent window covering the whole screen. I've tried both a WPF window with re-positioning of shapes on a Canvas, and drawing directly to the D3D DirectX instance of Desktop Window Manager and re-position by changing transform matrixes. These will result in some very annoying milliseconds of latency.
How do I draw on screen, a cursor which will move with low latency and low CPU?
If you're using D3D / DirectDraw.
Double buffering is known to cause input lag, triple causes even more. And if you take VSYNC into account then the process would block for even as much as 20 ms.
That means you will have a 20ms gap between the input events.
Double/Tripple buffering aren't usually the problem 'cause VSYNC blocks for 2000% the time required to render the screen.
Because normally it takes 1-2 ms to render the screen but 17-24 ms waiting for VSYNC.
For example [c++]:
- Take a look here .
I am total newbie in .Net programming so be patient, please ;-).
I have problem with resizing window. I want to resize from my app other app's window and take screenshot of it. I do resizing based on this example: http://blogs.geekdojo.net/richard/archive/2003/09/24/181.aspx. But I have a problem. I work on a laptop with 1024x640 pixels screen resolution but I want to resize my window to 1200x1600 px. I can't do that couse display limitations. Is there any tricky solution to resize window for this resolution and take a screenshot of whole window? I've alos tried Sdesk program witch is suggested here: Create Window larger than desktop (display resolution). Any help?
I would suggest you find a way to set a virtual resolution larger than your physical resolution (basically what sDesk does), and then let your application run normally on that large desktop. Depending on your video card, you might be able to configure the virtual resolution directly in the video driver, without using any additional utility.
No it is not possible. In fact you can't resize in any way the windows greater then the display size.
Just try it by position a window in normal mode (not minimized or maximized) somewhere on the left. Grab the right border of it and increase the width till the end of your screen. Now move the window, by grabbing the title bar, some more to the left. Repeat this procedure several times. At some point you're not able to get the window any wider anymore. If you now try to move the window till the right border hits the right side of your desktop, you'll see that the left border is direct at the left desktop side.
When you create a form in .Net it appears as a dialog box in a portrait layout.
No one normally likes to read sideways, or upside down, but I have a very valid reason to rotate the form.
Anyone knows how to do it on Windows Vista with C#?
Does it have to be in WinForms? This is very easy to do in WPF, using rotation transforms. Unfortunately, the WindowsFormsHost integration with WPF does not allow rotation transforms.
EDIT
I understand, now, that the form in question is out of the control of the poster. Writing the control in WPF won't fix the problem.
This would be a bit of extra work, but if you mainly just need the contents of the form to be rotated (and not the entire window including title bar, window controls etc., which I've never seen before), you could instead make an entirely owner-drawn usercontrol that was rotated 90 degrees, and drop it on an ordinary form. You wouldn't even have to adjust your drawing of everything, since you could do a RotateTransform on your Graphics object and then draw everything normally.
Or if you need the entire form rotated, you could make the form borderless and then do basically the same thing, drawing the title bar and windows controls yourself also.
Update: here's a link to an MSDN article that shows how to rotate the entire screen in C#:
http://msdn.microsoft.com/en-us/library/ms812499.aspx
This is for regular Windows (not Windows Mobile), so it should work for your porpoises, although it will rotate all of Windows and not just your application's form. Depending on how fast this works and your overall needs, you could rotate the screen 90 degrees when your application gets the focus, and then rotate it back to normal when your app loses focus.
Update 2: I just reread your question and comments. You're talking about rotating the window of a separate application in a separate process, so WPF will definitely not help you here. The MSDN link might be what you need. In your application, you would rotate the screen 90 degrees, then start the other application in a separate process. This would work best if you could force the separate application's window to be maximized, which you can do by P/Invoking the FindWindow and SendMessage APIs (you could also make the window always on top, which would put your computer into a sort of kiosk mode for this application). There's a version of the Process code that basically makes starting another application a blocking call, which means your app will wait for the shelled application to close before resuming. Once the app closes, you can put the screen back to its normal orientation.