-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
Updated 20.11.2023
This is a quick start guide to help you start out with IceCore
Download everything from this repository
You can either download this repo as a zip file, or clone it on your machine.
Find and open the "IceCoreEngine.sln" file
It is in IceCoreEngine\IceCoreEngine\IceCoreEngine.sln
Navigate to the Game1.cs file
As of writing this there is some code to show off input handling and rendering.
The major difference to base MonoGame here, is that the class Game1 inherits from IceCoreGame instead of Game.
This is not necessary, but the IceCoreGame class handles stuff like creating the input manager and graphics manager for you.
We can take a look at some of the code here.
In Initialize() we can see that Initialize is called on the base class (IceCoreGame) before anything else is done.
This is because we will be using features that are provided by the parent class.
protected override void Initialize()
{
base.Initialize(); // It is recommended that you do not do anything before this
...
}
Next up we are setting this window to be a borderless window, while in fullscreen. Setting the window to be fullscreen and applying settings.
Do note that this _graphicsManager comes from the IceCoreGame class.
protected override void Initialize()
{
...
_graphicsManager.SetBorderlessWindow(true);
_graphicsManager.SetFullScreen(true);
_graphicsManager.ApplySettings();
...
}
Next we are creating an input action in the input manager for closing the game and adding a trigger to it.
QuickAddTriggerToAction(EInput button, float multiplier) adds a trigger to the newest action that has been created.
Do not mind the callback function ExitGame()
protected override void Initialize()
{
...
_inputManager.AddInputAction(new InputAction(EInputType.Digital, ExitGame));
_inputManager.QuickAddTriggerToAction(EInput.Escape, 1f);
...
}
...
protected void ExitGame(float value)
{
Exit();
}
We also create two more input actions for moving around.
You can see we can easily add multiple triggers to one action with different multipliers.
You may also notice that the the exit action is a "Digital" input instead of "Analog". The differences between these two are explained in the input section of this wiki.
protected override void Initialize()
{
...
_inputManager.AddInputAction(new InputAction(EInputType.Analog));
_inputManager.QuickAddTriggerToAction(EInput.W, 1f);
_inputManager.QuickAddTriggerToAction(EInput.S, -1f);
_inputManager.AddInputAction(new InputAction(EInputType.Analog));
_inputManager.QuickAddTriggerToAction(EInput.D, 1f);
_inputManager.QuickAddTriggerToAction(EInput.A, -1f);
}