Next Generation Emulation banner
1 - 7 of 7 Posts

· You're already dead...
Joined
·
10,293 Posts
you can save an ini file with the options you want, and then load it at application boot-up.
that's my favorite way, since i think ini files are cool xD

there's also some very easy way to do this stuff in VB, but i don't remember how xD
 

· You're already dead...
Joined
·
10,293 Posts
I am using the simple rich text box to save the changes for ANY control I want.
i'm not sure i understand what you're doing.

do you mean write the settings to a hidden rich text box, and then save/load it to some file using a function?


oh wait....
are you even talking about saving/loading settings between application startup?
or are you just talking about saving settings while running the application?

in either case, a rich-text-box control seems like overkill.
at the very-least, you can use a String instead.
but one of the nicest ways (and the common way to do it) is to have a struct with the different application setting's data.

something like:

Code:
struct appData {
    bool option1;
    bool option2;
    int  option3;
}

appData mySettings; // Global Struct with the App's Settings
 

· You're already dead...
Joined
·
10,293 Posts
s.t.a.r.s.:

can't you just post the source-code? xD

but yeah... can't wait for the video :D
 

· You're already dead...
Joined
·
10,293 Posts
stars:

dude you could have just posted the source-code instead of a 45 minute video :D

but i actually learned something from that video.
msvc#'s form builder is very-very similar to VB.net. it also handles events like VB.
i just wish it supported macros and templates (especially macros, they're terribly useful).

anyways stars,
while that method does work, it is horribly inefficient and could get very messy if you have a lot of options.
 

· You're already dead...
Joined
·
10,293 Posts
c# has generics, but they're more limited than templates. you can't do "template metaprogramming" for example.
C# Frequently Asked Questions : How do C# generics compare to C++ templates?
Template metaprogramming - Wikipedia, the free encyclopedia

and functions aren't as nice as macros for some situations, and not everything a macro does can be done by functions.
also, even if you can do the job with a function, many times it will be less optimized since macros are compile-time generated code.

one time i used macros to generate some opcode tables that pointed to template-functions which needed multiple instances.
i reduced the tables from ~1000 lines to ~260 lines using macros.

Diff of microVU_Tables.inl r1166 - pcsx2 - Google Code

this would not have been possible using functions.
in fact, ~90% of the times i use macros, it can't be done with a function.

what if you have some really nested struct var that you use frequently like:
house.door.knob.keyhole = 1;
you can just do:
#define hKeyhole house.door.knob.keyhole
and use 'hKeyhole' instead, like:
hKeyhole = 1;

i also do stuff like that a lot too, although some people don't like it because its harder to understand the code at first glance.

there's a lot of other useful things macros are good for (too much to go into detail here). they're one big reason i like c++ so much.
before i learned the language, i didn't know there was something so powerful.
and i still didn't understand how powerful they could be till i looked at some of the different ways people used them xD
 

· You're already dead...
Joined
·
10,293 Posts
registering and creating windows and managing their events is what i hate about c++ too.
in fact, that's pretty much my only complaint about it.

also about readability:
on parts of code i don't want people to touch, then i don't care if the other people can read it or not, because they shouldn't be touching it.
on other stuff, i try to code nicely and comment anything too-complex.
 

· You're already dead...
Joined
·
10,293 Posts
how much do you know of win32 window creation?
well i'm far from an expert i'll tell you that xD

i basically learned the basics, implemented some code and just reuse it on future projects.
then i read up on msdn or some tutorials whenever i need to use new controls.
a wise coder once told me something like:
"There's no need to memorize everything, that's what docs are for."

i used to think i was supposed to memorize crap like window registration code, and DX initialization code. but then i found out people just copy the code when needed, and just memorize "how to use it", instead of memorizing the specifics.


so far, most my projects in c++ have not needed anything too-fancy in terms of window creation, and i've been able to do everything i needed.

i implement new dialog boxes using the MSVC dialog builder.
you can see an easy example on how to open new dialog boxes created with the dialog-builder when you create a new win32 application with Visual Studio and use the Win32 Application Setup Wizard.
they generate an about-box dialog for you, and you can just do some copy-pasting/modding to create new windows xD

that's basically how i get by.
if i had an application that's very window-heavy and not performance critical, then i'd use VB instead since its a lot simpler.
i plan to learn c# in the future, so i might start using that as my 'rapid app development' language.


also one thing i learned:
even very experienced c++ veterans hate implementing fancy c++ gui stuff. its just a pain to code, and the gui is something you just want to get done so you can code the 'real stuff'. xD
 
1 - 7 of 7 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top