C++ helpen out blitz.

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

C++ helpen out blitz.

Post 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.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post 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++.
Guest

Post 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
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

C++ helpen out blitz.

Post 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. :cry:


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.
Last edited by JS Lemming on Sat Oct 16, 2004 6:11 pm, edited 2 times in total.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
Guest

Post 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
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post 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?
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post 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.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post 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.
User avatar
Don Pwnious
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 833
Joined: Tue Jun 15, 2004 5:32 pm
Location: on the streets wit my j23
Contact:

Post by Don Pwnious »

ohhh lemming will have to explain in school
1/8th time- 14secs
1/8th speed - 110mph
Guest

Post 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
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post 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.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post 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.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post 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.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
Post Reply