C++

Miscellaneous Forums/General Discussion/C++

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I've gotten it to work, thanks guys, the main thing that helped me is that blitzmax uses pointers only. anyways here's the updated code(I also didnt define update):

C++
#include <string>

using namespace std;

extern "C" {
    class cParticle {
    public:
          float x;
          float y;
          
          void Update(void); 
    };
    
    void cParticle::Update() {
         x++;
         y++;
    }
    
    cParticle *cCreateParticle(void) {
         return new cParticle; // is this right?
    }
    
    void cDeleteParticle(cParticle *p) {
         delete p; // is this right?
    }
    
    void cUpdateParticle(cParticle *p){
         p->Update(); // what about this one?
    }
    float ParticleX(cParticle *p) {
          return p->x;
    }
    float ParticleY(cParticle *p) {
          return p->y;
    }
}


bmax:
SuperStrict

Import "main.cpp"


Extern "C"
	Function cCreateParticle:Byte Ptr()
	Function cUpdateParticle(p:Byte Ptr)
	Function cDeleteParticle(p:Byte Ptr)
	Function ParticleX:Float(p:Byte Ptr)
	Function ParticleY:Float(p:Byte Ptr)
End Extern

'What data type? 
Local part:Byte Ptr = cCreateParticle()

Print ParticleX(part)+" , "+ParticleY(part)

cUpdateParticle(part)

Print ParticleX(part)+" , "+ParticleY(part)

cDeleteParticle(part)


End