1
\$\begingroup\$

I will get to the main question later but I just want to give the backstory here first. I program a game in XNA using VB.NET. As I'm testing the game in debug it works at a certain speed (spritemovement, animations etc.). After I publish the game and install it on my other computer (which is newer), the game slows down considerably. To investigate that problem I used FPS code. It showed 75 on debug and 60 after installed. I have thus programmed the entire game for running at 75. To try to solve that problem I incorporated this:

TargetElapsedTime = TimeSpan.FromSeconds(1.0F / 75.0F)
IsFixedTimeStep = True

Now after trying to publish again the game actually ran smoothly at 75fps on the newer computer, but there was a catch: when I turn to fullscreen the game again slows down. However now without showing the lower fps. So the fps is still showing 75 but the game apparently runs at 60.

I've looked around for answers and find that I can possibly maximize the window (borderless) without making it fullscreen, and could perhaps solve the problem that way. However all the code suggested are in C# and I can't get it to work.

How can I either get a borderless maximized window to work with VB.NET, or in any other way solve my FPS issue?

Thank's for any help on this issue!

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

If this is the code you wanted to use for a borderless window, here's the VB.NET version (it's untested as I don't have XNA on this machine)

Dim hWnd As IntPtr = Me.Window.Handle
Dim control = System.Windows.Forms.Control.FromHandle(hWnd)
Dim form = control.FindForm()
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None

Is there a reason you want to increase the FPS to 75 and not the default of 60? This thread might be worth a read regarding that.

\$\endgroup\$
3
  • \$\begingroup\$ Ok. Thank's I'll try it out. I also need the code to maximize the window without fullscreen, which was located in many of the same posts that the code for borderless window was when I searched. I'll see if I can locate one of them and link from here \$\endgroup\$ Commented Jul 17, 2016 at 9:27
  • \$\begingroup\$ ah this could be it, and might work on VB.NET: form.WindowState = FormWindowState.Maximized \$\endgroup\$ Commented Jul 17, 2016 at 9:51
  • \$\begingroup\$ form.WindowState = FormWindowState.Maximized. This code just maximized the borders, and thus doesn't scale the image. Big black areas instead fill whats left (if the resolution is higher on the screen than in the game) \$\endgroup\$ Commented Jul 17, 2016 at 9:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .