Win32 programming...not as fun.

The Partridge Family were neither partridges nor a family. Discuss.
albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Win32 programming...not as fun.

Post by albinopapa » March 10th, 2017, 4:46 am

You know I haven't done a lot of win32 programming and it's not as if I've made any games either. Both seem to have their challenges, but game programming is so much more rewarding.

I'm trying to make a program to track how much I owe my son for chores. It's also a way for him to keep track of what chores he's done and which ones still to do. The final thing it'll do is separate his earnings into categories; charity, short term and long term savings. Charity could be like birthday gifts or actual charity.

Chili was right about one thing though...many more actually, but C# get's you up and running with this stuff way faster than with C++ thanks to the .NET framework and the visual editor. Being able to visually layout the window form and then just fill in the code afterward is nice. For this project, I'm using C++ and am having to decide how to layout everything and of course learn how window controls work.

I think I have a pretty good idea on how I want to accomplish most of the core functionality, just not looking forward to it. I'm going to have to keep track of dates, chore descriptions and prices so basically a data base of transactions. I'll need to be able to scroll this list of transactions so I do have a few questions for any of you who've done some Win32 programming.

Should I make each record it's own STATIC control?
Should I just make a read-only multi-line EDIT control that shows for example ten records at a time?
I could also roll my own solution using Direct2D/DirectWrite I suppose. That sounds more rewarding lol, but I'd like to know what you all think.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Win32 programming...not as fun.

Post by cameron » March 10th, 2017, 5:15 am

As fun as it would be to roll something with d2d, I'd go with c# + .net to be honest... Much more rubust and much faster development time. win32 controls are okay but are a pain in butt to work with. If you do go the win32 route make dialogs in the resource editor. I used win32 from the beginning for my chat app and I regret not using c#.
Computer too slow? Consider running a VM on your toaster.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Win32 programming...not as fun.

Post by albinopapa » March 10th, 2017, 8:00 am

Yeah, I asked my son which I should go with, thinking I'm a badass, but am kind of regretting not going with C#.

I made a Spades score sheet using C#, but I couldn't make a full on spades game because the only thing I could figure out how to do was handle events, like changing bids. I couldn't figure out how to make the rest of the game. As stated, all I could figure out is to handle events, as if I was only able to make OnChange() functions. The Application::Run function, do you need to do something with that?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Win32 programming...not as fun.

Post by albinopapa » March 10th, 2017, 4:06 pm

Hmm, I never really described what I envisioned.

Code: Select all

__________
CHOREVIEW \__________________________________________________
Date      | Chore description             | Value     |  Is complete? | Total owed  |
------------------------------------------------------------------------------------- |
3/14/17 | Clean litter box                | $0.50     |        X           |  $0.50        |
3/14/17 | Wash colors                     | $0.50     |                     |  $0.50        |
3/16/17 | Clean room                      | $1.00     |        X           |  $1.50       |
                                                                                                              |
_____________________________________________________________|
Then, about the same layout but different data for the accounts that I mentioned, on a different tab.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Win32 programming...not as fun.

Post by cameron » March 10th, 2017, 7:46 pm

I suppose you could do something with the program entry point if you really needed to be doing stuff throughout the entire game. But, C# with .net is meant to be event based programming. I have made games with .net which are entirely event based, it is different from what you are probably used to, but it is often used. javascript (which I am taking a class right now) is entirely event driven, and I have to make a fully functional checkers game. Basically here is how it boils down

Program entry point - Initialize everything you need to start the game
Events - Make events for when things should happen in a game and put the logic in the handler for that event. For example: in checkers I used an onclick event for table cells and I was able to use game logic to determine what the user was trying to do based on the previous click, owner of checker etc...
Program exit - Cleanup if necessary.

It would be fun to try and write a event driven framework for c++.

If you wanted it to be graphically heavy with lots of animations and other stuff you would just want to go with c++. But for a card, or board game c# with .net works great.
Computer too slow? Consider running a VM on your toaster.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Win32 programming...not as fun.

Post by albinopapa » March 10th, 2017, 8:36 pm

Yeah, I wanted to have the cards animate across the table as if they were being dealt, but couldn't think how to accomplish that with only having access to OnClick type functions. I'm pretty sure you wouldn't use the Windows Forms template. The entry point Run function has like three overloads so I'm thinking you'd have to go that route.

Your chat program is almost all event driven and in C++ right?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

JDB
Posts: 41
Joined: August 5th, 2015, 9:50 am
Location: Australia

Re: Win32 programming...not as fun.

Post by JDB » March 10th, 2017, 11:52 pm

I would suggest using a timer to move the cards, you start the timer when the cards should begin moving and at every tick of the timer you adjust their position slightly, then stop the timer after a certain number of adjustments.

I recently discovered that it's also possible to create Windows UI apps using C++ but it's a bit less user friendly than C# or VB. While creating The Local Bay I needed the searches to run as fast as possible so I was sort of forced to use C++.

I have uploaded the source code if you want to take a look. It's also worth mentioning, although I assume you already know, the code for event functions can be automatically generated just by double clicking an empty event in the properties panel.

The properties panel may be hard to enable if you don't already have it enabled, depending on what version of VS you're using. Once you have it open, select a form object, then click the button in the properties panel which looks like a lightning strike, that will show a list of events for the object.

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Win32 programming...not as fun.

Post by cameron » March 11th, 2017, 2:07 am

Yeah you'd want to create some kinda timer and do X every Y, probably on a different thread.
Computer too slow? Consider running a VM on your toaster.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Win32 programming...not as fun.

Post by chili » March 11th, 2017, 4:43 am

I created a stupid MDI application thing back like over 15 years ago. Handling scrollbars, forms, all that shit manually and by code. What a fucking pain in the ass XD

You can animate your shit in C# with a timer easy enough. That's how I did the animation preview for my stickman sprite rotoscoping tool.
Chili

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Win32 programming...not as fun.

Post by chili » March 11th, 2017, 4:51 am

Here is what that looked like.
Attachments
figgy.gif
(388.42 KiB) Not downloaded yet
Chili

Post Reply