Wednesday, 2 January 2008

What do you mean 500 buttons is too many?

So I started on the level editor today, and it's actually been going quite well. However, it turns out that my method of programmatically adding in a grid of 25*20 toggle buttons to represent the grid squares isn't really going to work apparently - I didn't think the idea through long enough to realise that adding five hundred individually functioning buttons, each with two 16*16 pixel high-quality *.PNG images to load, would crash the computer.

But on the bright side, it was a very spectacular crash. First I got the classic sandtimer cursor to appear and then freeze mid-animation, so it was actually sitting sideways, then the application's window appeared in two places at once - half was in the normal position and half was in the top-left corner of the screen, with funky black and white lines attempting to hold them together. Then a window appeared saying "Error: Out of system resources!" before promptly disappearing under a wave of long-awaited buttons which proceeded to draw themselves very slowly, one after the other. At this point, I quickly killed the process using the Windows task manager. And with all the speed with which the carnage had arrived, everything fell silent.

So, yeah, computers aren't meant to handle 500 buttons. Which means I'm going to have to look for a different approach; maybe I'll write a custom GUI grid thingy myself at some point. It can't be that hard to do anyway; Microsoft had something similar in their Minesweeper game that comes with Windows and it loads in milliseconds whilst using almost no system resources at all.

No comments:

Post a Comment