Game Development Reference
In-Depth Information
Screen.SetResolution(1600, 900, fs);
break;
case 2:
Screen.SetResolution(1280, 1024, fs);
break;
case 3:
Screen.SetResolution(1280, 800, fs);
break;
case 4:
Screen.SetResolution(640, 400, fs);
break;
}
}
For this function, we receive two values. The first
int
value decides which resolution
we will use and the next
int
value determines whether the game will be full screen
or not. Inside the function, we create a
bool
variable, which will be used to determ-
ine the fullscreen option. To use the
int
value we passed to the function, we convert
the
int
value to a Boolean by using the
Convert
function.
Next, we use a
switch
statement to decide which resolution to set the game to.
Which resolutions you want your game to support is up to you, but you should try to
support various resolutions because everyone has their own preferences. To set the
resolution, we access the
SetResolution
function on the screen, set the resolu-
tion values, and then set the
fullscreen
value.
Toggling the anti-aliasing property
The next video setting that we'll modify is the anti-aliasing property. Aliasing in a
game is where the models being rendered have jagged edges. Anti-aliasing is what
the game renderer does to smooth out those jagged edges. To do this, the renderer
will blur the edges slightly to make them smooth. This is one of the options that will
make your game look great, but will also slow down the performance. Add this func-
tion to your script: