Page 1 of 1
C++ helpen out blitz.
Posted: Sat Oct 16, 2004 12:42 pm
by JS Lemming
I found something pretty neat just a few seconds ago while looking through mai old blitz folder.
You can write functions in C++ and compile them into .dll's. Which blitz will then recognize in it's IDE and stuff. Not that I'm going to use blitz or anything, but i bet Arce will think it's pretty koo.
Posted: Sat Oct 16, 2004 5:02 pm
by Falco Girgis
That's pretty cool. yeah, I'm glad this find hasn't made you want to go back to settling for blitz, but I'm sure that I could cook up some coolness for Marcel's game in C++.
Posted: Sat Oct 16, 2004 5:44 pm
by Guest
In order for you to "cook up coolness" for my game, would I have to like redo everything? LIke, if I wanted to add in a function or whatever in C++, then how would I use them, C++ doesn't have types and stuff, how would that work? o.o
C++ helpen out blitz.
Posted: Sat Oct 16, 2004 6:11 pm
by JS Lemming
Arce, you know when you type a key word command like .... Abs() for example... and it turns yellow like.
Well, you can make your own functions that act just like that. Like they were built in all along.
AND c++ is more powerful and FASTER!!!!!! Oh the pointers!
They should have named pointers something cooler.
EDIT - hehe. i just noticed i didn't answer your question. A: you would use one of the many different ways to iterate throuh classes in c++ instead of types yo.
Posted: Sat Oct 16, 2004 11:31 pm
by Guest
So if I wanted one, lets say, collision function in C++, I'd have to redo the whole program so it doesn't have types? o.o
Posted: Sat Oct 16, 2004 11:49 pm
by Falco Girgis
Yeah, JSL, are you talking about referring to types from C++ as if they were just classes, declaring the classes in C++ then somehow using them in blitz, or having the blitz and C++ classes/types be completely noncompatable with each other?
Posted: Sun Oct 17, 2004 12:13 pm
by JS Lemming
Arce wrote:So if I wanted one, lets say, collision function in C++, I'd have to redo the whole program so it doesn't have types? o.o
No not at all. What does types have to do with a function. All you have to do is make a c++ function like so:
Code: Select all
//Returns true if the two rectangles are overlapping
bool RectsOverlap(int x1,int y1,int width1,int height1,int x2,int y2,int width2,int height2) {
if((x1+width1 > x2) && (x1 < x2+width2)) {
if((y1+height1 > y2) && (y1 < y2+height2)) {
return true;
}
}
return false;
}
Then in your blitz program, you can simply do:
Code: Select all
if RectsOverlap(dude\x,dude\y,32,64,bullet\x,bullet\y,2,2)
dude\life = dude\life - 1
endif
Now you are probably saying, i could have done that in blitz! And you could have, but you get to use all the neat features of C++ if you do it this way.
PS. that collision function was just an example!!!
Super Sonic wrote:Yeah, JSL, are you talking about referring to types from C++ as if they were just classes, declaring the classes in C++ then somehow using them in blitz, or having the blitz and C++ classes/types be completely noncompatable with each other?
Remember when i said:
A: you would use one of the many different ways to iterate throuh classes in c++ instead of types yo.
Well, i must have been half asleep/dead. I meant to say that you could just have a loop and iterate through your types while passing thier data into the function, makeing classes useless. Sorry.
Posted: Sun Oct 17, 2004 12:31 pm
by Falco Girgis
Yeah, I see exactly what you mean. That's kinda cool actually. Sorta reminds me of assembly optimization. Optimizing your sub-par blitzness with C++ goodness. I kinda like that.
Posted: Mon Oct 18, 2004 6:10 pm
by Don Pwnious
ohhh lemming will have to explain in school
Posted: Mon Oct 18, 2004 6:32 pm
by Guest
That's awsome! I always hear how blitz\s collisions cause lag, wouldn't that help it? o.o
And anyway, I know this is off topic, but can you tell me WTF a memory bank is and does in blitz? And about gadgets? AND progress bars? o.o
Posted: Tue Oct 19, 2004 7:36 am
by JS Lemming
A memory bank is just that, a block of memory set aside for your use. What's so great about it? The fact that it is FAST. Fast as a mug. It's perfect for compression functions and stuff.
Gadgets: You might have noticed that blitz can also make windows like programs (note: VmuGx). Gadgets are things like buttons and scroll bars and menus and everything.
A progress bar is a gadget that can be used to inform the user how muchan operation has been completed. Example: A load bar.
Posted: Tue Oct 19, 2004 8:47 am
by Falco Girgis
Hey, JSL, how do you compile C++ goodness to a .DLL that BlitzPlus can use? I'm going to let Arce use the collision function from NEStix. Perhaps that'll speed up t3h performance.
Posted: Tue Oct 19, 2004 3:58 pm
by JS Lemming
THe only way I know how to make .dll's is with Dev-cpp. In the project options it asks you if you want to make a dll. I'm not sure about Vc++... try project options.