New answers tagged

-1

Option (C): change the screen resolution back to 800x600. Even if you don't do this, consider it as a thought experiment. In that case, it's the responsibility of the display to resize the graphics to fit its physical size, and then the responsibility of the operating system to give you pointer events at an 800x600 resolution. I think it all depends on ...


0

ClassicThunder's answer is correct, but I'd like to provide an example of an alternative/simpler means of achieving the desired effect. This is a simpler solution for rapid prototyping, cases where you don'thave access to a fully featured library, or for cases where you don't have access to a GPU (e.g. in embedded systems). To perform said mapping, you can ...


2

Another option would be: On each input mouse movement event, move the in-game mouse cursor by the number of game pixels corresponding to the number of pixels in the mouse event. This comes naturally for 3D games that lock the real mouse pointer to the center and rotate the aim direction by an amount corresponding to the input mouse movement, but you could do ...


37

Typically (even for 2d games) there is a separate coordinate system for the game that is independent of the resolution, this is typically referred to as the world space. This allows you to scale to an arbitrary resolution. The easiest way to achieve this is use a 2D Camera, which is essentially a matrix that defines the transition from world space (your ...


1

Windows: Imho, one should completely avoid fullscreen mode. There is no longer any performance advantage with it, those days are gone. If you want to cover the entire screen, just create a borderless and captionless window with fullscreen dimensions. This gives you advantages: Only one set of code: If going directly fullscreen at program start, one ...


2

I don't think your code is doing what you think it's doing. If I run that code on my computer I get 23,879,696 resolutions in the list. I think what you intended to write was something more like this: List<Vector2> resolutions = new List<Vector2>(); foreach (var item in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes) { ...


0

SDL2 actually supports this natively. While it caused me some artifacts while rendering tile-based maps, it works pretty nicely with everything else. I'm not 100% sure on this, but I think SDL also automatically transforms for an example mouse coordinates to work with the scaling nicely. So, to enable scaling, you only need to call ...


0

This requirement is not easy to fulfill. Of course you can upscale the design to a higher resolution, but this will make fonts, images just bigger, which normally does not too so nice. To avoid this you can try to define anchors for things like your text-box or your avatar-picture. When resizing the screen / window they should stay at the right ( for the ...



Top 50 recent answers are included