![]() |
|
AlC++ Coming Soon! |
Wer fu
Member #1,084
March 2001
![]() |
AlC++, a C++ wrapper for Allegro is coming soon. It's still in early developpement and no package is ready to be release now, but can use the CVS to see how it look. The AlC++ Homepage is http://alcpp.sourceforge.net. Stay tuned during the next two week, a working package will surely be available. The future is coming!
ICQ:71667703 or Email&MSN: werfu_dx@yahoo.fr |
kazzmir
Member #1,786
December 2001
![]() |
i downloaded the code using cvs. its not very c++'y. i mean, it kinda looks like you want to use inheritance, but you dont really just the friend keyword. and whatsup with using instanceof? thats a super nono in the land of object orientism. are things supposed to be objects anyway? if so, why use static variables? maybe for some things like timers it should be static, but probably not for bitmaps and mouses. |
Wer fu
Member #1,084
March 2001
![]() |
The mouse and the timer variable are static because even if there are many object of these type, only one truely exist. These are object but see them more like handles. Anyway, I've made these static because I didnt wan't create error if someone create more than one handle of each type. I mean: AC_Mouse FirstMouseHandle(); //All variable and pointer will be inited AC_Mouse SecondMouseHandle(); //No initialisation need to be done These two mouse handle do exactly the same work (and I don't see the goal to have two of them) so there is no need to duplicate pointers only for fun of spending memory. The instanceof is for identifying of which type is the class built, but I guess this keyword will not work in C++ as it is Java... I'll do a fonction that return the type of the class if so. And why do you scream about this is not object oriented? This is only alpha version and don't forgot there is only three classes implented for now; the mouse, the timer and the joystick. I see them more like handle than object because you can't truely (in hardware) have plenty of them. Wait for the bitmap class! I plan to create this one by inheriting of the current BITMAP struct, so it will directky work in the current Allegro function without any tweak. And more there is more coming! The screen class will be like the timer (you can create many handle, but it all do the same thing) but the GFX mode and the colordepth will be set when constructing the screen class. This mean there will be many screen that could have their own resolution and maybe their own colordepth (this will be hard to do).
ICQ:71667703 or Email&MSN: werfu_dx@yahoo.fr |
Apokalypse
Member #2,543
July 2002
![]() |
Faced with porting a program from Java to C++ I had to find a replacement for instanceof...I didn't so I had to make do with a really annoying extra variable for all my classes (classtype), which was just more work. later I discovered dynamic_cast... do dynamic_cast<class>(pointer), and it returns a valid pointer of the correct type or 0 (null). It's basically the same as instanceof, but because of pointer arithmetic it is slightly different... |
Thomas Fjellstrom
Member #476
June 2000
![]() |
maybe using the 'typeof' keyword will work? -- |
Rash
Member #2,374
May 2002
![]() |
template <class D,class B> inline bool instanceof(const B& b) { return dynamic_cast<const D*>(&b)!=0; } Anyway, typeof does something completely different (and is nonstandard BTW). |
Bob
Free Market Evangelist
September 2000
![]() |
I think Thomas was thinking of typeid. -- |
Rash
Member #2,374
May 2002
![]() |
If an object is an instantiation of a derived class, then, unlike typeid, dynamic_cast will still succeed if an ancestor class is given as parameter. |
the_y_man
Member #1,770
December 2001
![]() |
I think that's a great idea, but personally, i wouldnt like using a wrapper for another wrapper (under windows). |
Marcello
Member #1,860
January 2002
![]() |
If all functions are inlined, then it'd be no different than using pure c, yes? Marcello |
Thomas Fjellstrom
Member #476
June 2000
![]() |
not with that dynamic_cast in there, that requires RTII which is deffinitly slower than inlined methods... -- |
Wer fu
Member #1,084
March 2001
![]() |
Rash, can you explain me how work what you wrote? I never worked with the STL (but I plan to learn it). Marcello: For now it doesn't change many thing, but wait for the next version. AlC++ will be design to let anyone add their own module to it just by inheriting from the base class.
ICQ:71667703 or Email&MSN: werfu_dx@yahoo.fr |
23yrold3yrold
Member #1,134
March 2001
![]() |
Rash didn't use the STL, he's just using the template keyword to write his own function. -- |
|