Got the static library working:
here is the code:
the cpp file
#include "Flibrary.h"
#include "DarkGDK.h"
#include "windows.h"
void SetPhysicsOnObject(int obj, float mass)
{
dbMoveObjectDown( obj, mass);
}
void SetPhysicsOnCamera(int Cam, float mass)
{
dbMoveCameraDown(Cam, mass);
}
float GetDistance(int obj1, int obj2)
{
float obj1X = dbObjectPositionX ( obj1 );
float obj1Y = dbObjectPositionY ( obj1 );
float obj1Z = dbObjectPositionZ ( obj1 );
float obj2X = dbObjectPositionX ( obj2 );
float obj2Y = dbObjectPositionY ( obj2 );
float obj2Z = dbObjectPositionZ ( obj2 );
float dist;
float dx;
float dy;
float dz;
dx = obj2X - obj1X;
dy = obj2Y - obj1Y;
dz = obj2Z - obj1Z;
dist = sqrt ( ( dx * dx ) + ( dy * dy ) + ( dz * dz ) );
return dist;
}
float GetDistanceCamera(int Cam, int obj)
{
float CamX = dbCameraPositionX ( Cam );
float CamY = dbCameraPositionY ( Cam );
float CamZ = dbCameraPositionZ ( Cam );
float objX = dbObjectPositionX ( obj );
float objY = dbObjectPositionY ( obj );
float objZ = dbObjectPositionZ ( obj );
float dist;
float dx;
float dy;
float dz;
dx = objX - CamX;
dy = objY - CamY;
dz = objZ - CamZ;
dist = sqrt ( ( dx * dx ) + ( dy * dy ) + ( dz * dz ) );
return dist;
}
void ControlCameraUsingWASD(int cam, float ForwardSpeed, float BackSpeed, float LeftRightSpeed)
{
if (dbKeyState( 17 ) ==1 )
{
dbMoveCamera ( cam , ForwardSpeed );
}
if ( dbKeyState( 32 ) == 1 )
{
dbYRotateCamera ( cam , dbCameraAngleY( 0 ) + 90 );
dbMoveCamera ( cam , LeftRightSpeed);
dbYRotateCamera ( cam , dbCameraAngleY( 0 ) -90 );
}
if ( dbKeyState(31)==1 )
{
dbYRotateCamera ( cam , dbCameraAngleY( 0 ) -180 );
dbMoveCamera ( cam , BackSpeed );
dbYRotateCamera ( cam , dbCameraAngleY( 0 ) +180 );
}
if (dbKeyState(30)==1)
{
dbYRotateCamera ( cam , dbCameraAngleY( 0 ) -90 );
dbMoveCamera ( cam , LeftRightSpeed );
dbYRotateCamera ( cam , dbCameraAngleY( 0 ) +90 );
}
}
void MakeButton(int img,int sprite, int HighLightImg, int HighLightSprite ,int posX, int posY)
{
dbSprite( sprite, posX, posY, img);
dbSetSprite(sprite, 1, 0);
dbSetSprite( HighLightSprite, 1, 0);
if (dbMouseX()>(posX)&&dbMouseX()<(posX+(dbGetImageWidth(img)/2))&&dbMouseY()>posY&&dbMouseY()<posY+(dbGetImageHeight(img)/2))
{
dbSprite(HighLightSprite, posX, posY, HighLightImg);
dbShowSprite(sprite);
}
else
{
dbHideSprite(HighLightSprite);
}
}
void SmootControleCameraUsingWASD((int cam,float ForwardSpeed, float BackSpeed,float LeftRightSpeed, int Acceleration)
{
float LeftSpeed = LeftRightSpeed;
float RightSpeed = LeftRightSpeed;
LeftSpeed < Acceleration;
RightSpeed < Acceleration;
ForwardSpeed < Acceleration;
BackSpeed < Acceleration;
if (dbKeyState( 17 ) ==1 )
{
ForwardSpeed = ForwardSpeed + Acceleration;
}
else
{
ForwardSpeed = 0;
}
if(dbKeyState(30)==1)
{
LeftSpeed = LeftSpeed + Acceleration;
}
else
{
LeftSpeed = 0;
}
if(KeyState(31)==1)
{
BackSpeed = BackSpeed + Acceleration;
}
else
{
BackSpeed = 0;
}
if(KeyState(32)==1)
{
RightSpeed = RightSpeed + Acceleration;
}
else
{
RightSpeed = 0;
}
dbMoveCamera(cam, ForwardSpeed);
dbMoveCameraLeft(cam, LeftSpeed);
dbMoveCameraRight(cam, RightSpeed);
dbMoveCamera(cam, (-BackSpeed));
}
i include it the windows.h for some othere thing ill be doing later
and here is
the headher file source
#ifndef FLIBRARY_H
#define FLIBRARY_H
void SetPhysicsOnObject(int obj, float mass);
void SetPhysicsOnCamera(int Cam, float mass);
float GetDistance(int obj1, int obj2);
float GetDistanceCamera(int Cam, int obj);
void ControlCameraUsingWASD(int cam,float ForwardSpeed, float BackSpeed,float LeftRightSpeed);
void MakeButton(int img,int sprite, int HighLightImg, int HighLightSprite ,int posX, int posY);
void SmootControleCameraUsingWASD((int cam,float ForwardSpeed, float BackSpeed,float LeftRightSpeed, int Acceleration);
#endif
Game.Love