Handmade Hero»Forums»Code
Ian Hern
8 posts
How to go from making a game to making an app?
Edited by Ian Hern on
If I wanted to take what I've learned here and make a windows application instead of a game can I use the same approach of having a draw and update loop? Is there a better way of going about it?
Mārtiņš Možeiko
2559 posts / 2 projects
How to go from making a game to making an app?
Yes, you can. Imgui library that Casey mentions often on a stream, gives you API for creating UI for any kind of application. And it works in a way exactly what you said - drawn and update loop.

Check out homepage here: https://github.com/ocornut/imgui
And see screenshots from various applications here: https://github.com/ocornut/imgui/issues/123
popcorn
70 posts
How to go from making a game to making an app?
I guess you can follow some of the rules he has like Write usage code first and such.

I'm not sure about allocating memory first though, it would work for somethings but for like continuous data app like an IRC where you get tons of messages. I guess you can allocate a big chunk like let's say 1GB and when you run out, delete the old messages? It might be a bit tricky.
Bryan Taylor
55 posts
How to go from making a game to making an app?
C0D3
I guess you can follow some of the rules he has like Write usage code first and such.

I'm not sure about allocating memory first though, it would work for somethings but for like continuous data app like an IRC where you get tons of messages. I guess you can allocate a big chunk like let's say 1GB and when you run out, delete the old messages? It might be a bit tricky.

Game or not, the user doesn't have an infinite amount of memory. And unless you're writing something that is a primary application (think web browser), you need to keep your memory footprint as small as you reasonably can. And for that, pre-allocating (or at least allocating in discrete chunks) is a pretty good idea.

(The way things like IRC clients handle this is: you keep a small buffer of backlog, and write the rest out to disk. Any IRC client that allocates a GB of memory is going to get canned immediately.)

poohshoes:
There's certainly nothing *stopping* you from writing a normal application this way. The difference is that you can't necessarily assume you have full control of the machine. With a game, (especially a fullscreen one), we can feel pretty confident that we don't need to leave plenty of memory and CPU time on the table for other processes. With an application, you usually do. This isn't *hard*, but it's a thing to keep in mind.