Tick
event handler and add the following code to it:private void timerGameUpdate_Tick(object sender, EventArgs e) { if (hScrollBar1.Maximum < 0) { FixScrollBarScales(); } game.Tick(); if (game.HoverCodeValue != lblCurrentCode.Text) lblCurrentCode.Text = game.HoverCodeValue; }
Using the scroll bars does not prevent the Timer control from firing its Tick
event, so by executing the game's Tick()
method from within the timerGameUpdate_Tick()
event handler, we can force the game's Update()
and Draw()
methods to run even when they normally would not.
The last item in the timerGameUpdate_Tick()
handler checks to see if the HoverCodeValue
inside the Game1 class has been updated since it was last copied to the label displaying it on the Windows Form. If it has, the form label is updated as well.
The last thing we need to address to complete the Gemstone Hunter Level Editor is how we will load and save our map files. There are a number of ways we could store our level maps, but we will implement a very simple method that does not require parsing XML or creating a text file with a special format to store the map.
18.117.142.248