1 registered members (Quad),
762
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: A few questions about lite-C game development
[Re: kmega00]
#431107
10/09/13 13:24
10/09/13 13:24
|
Joined: Sep 2009
Posts: 993 Budapest
Aku_Aku
User
|
User
Joined: Sep 2009
Posts: 993
Budapest
|
I am not sure what do you talk about, i assume it is a type of the numeric variables. There integers where there is no decimal point. There are decimal numbers, they have integer part and fraction part and between them there is the decimal point. Here are two subtypes, the first has fixed number of decimal numbers, and the second part where the decimal point can move left-right or foreward-backward. Here is the web page what is describe this variable type, better than me: Floating point
|
|
|
Re: A few questions about lite-C game development
[Re: Aku_Aku]
#431124
10/09/13 17:11
10/09/13 17:11
|
Joined: Oct 2013
Posts: 21
kmega00
OP
Newbie
|
OP
Newbie
Joined: Oct 2013
Posts: 21
|
Thanks for the info on floats. Another question from the manual (I'm slowing reading through it): Want to make sure I'm understanding this example from Strucs under the programming tab in the manual.
function spot_init(SPOT* spot)
{
if (!spot) return; // prevent crash when an empty pointer is passed
spot.x = 1;
spot.y = 1;
}
...
SPOT myspot; // creates an uninitalized SPOT struct named "myspot"
...
spot_init(myspot); // passes a pointer to myspot
It's my belief function spot_init sets myspot.x to 1 and myspot.y to 1 when it's ran with (myspot) as an argument?
Last edited by kmega00; 10/10/13 20:57.
|
|
|
Re: A few questions about lite-C game development
[Re: sivan]
#431133
10/09/13 18:19
10/09/13 18:19
|
Joined: Oct 2013
Posts: 21
kmega00
OP
Newbie
|
OP
Newbie
Joined: Oct 2013
Posts: 21
|
I'm feeling pretty good I understood or at least understood enough about the last example. I'll continue to post about things I don't understand here. A while back I tried to build a game with mostly just the knowledge I had obtained from the lite-c tutorial alone. I'll share a few screen-shots and the unfinished code I was working with. I don't plan to finish this game because I'm trying to learn as much as I can from the Acknex manual and then build a much better one that is procedural. The more I learn from the manual the more I realize I could have had a much easier time coding. I believe posting over 3,000 lines of code here might be too much? The code can be downloaded from zippyshare here: msf.cAnother question: A function sample under Functions tab within programming category:
function vector_add2 (var* sum,var* v1,var* v2)
{
//calculate the sum of two vectors
sum[0] = v1[0] + v2[0];
sum[1] = v1[1] + v2[1];
sum[2] = v1[2] + v2[2];
}
var vector1[3] = { 1,2,3 };
var vector2[3] = { 4,5,6 };
var vector3[3];
//...
vector_add2 (vector3,vector1,vector2); //vector3 now contains 5,7,9
I understand that different argument types are supported but... can I pass other argument types at the same time such as
function vector_add2 (var* sum,var* v1,var* v2,ENTITY* ent,PARTICLE* p) ???
{
//calculate the sum of two vectors
sum[0] = v1[0] + v2[0];
sum[1] = v1[1] + v2[1];
sum[2] = v1[2] + v2[2];
}
var vector1[3] = { 1,2,3 };
var vector2[3] = { 4,5,6 };
var vector3[3];
//...
vector_add2 (vector3,vector1,vector2); //vector3 now contains 5,7,9
Last edited by kmega00; 10/10/13 20:56.
|
|
|
Re: A few questions about lite-C game development
[Re: sivan]
#431181
10/10/13 19:32
10/10/13 19:32
|
Joined: Oct 2013
Posts: 21
kmega00
OP
Newbie
|
OP
Newbie
Joined: Oct 2013
Posts: 21
|
An example under Programming, under Precompiler, (#ifdef,#ifndef,#else,#endif)
#define LOW_RES
...
#ifndef LOW_RES
video_mode = 8; // 1024x768
#else
video_mode = 6; // 640x480
#endif
I partially understand this example. I'm assuming that I may never need to wright code using this? I don't see the advantage since you can use functions for this also. Does this have any advantage over functions if your only programming in lite_C ?
Last edited by kmega00; 10/10/13 20:54.
|
|
|
Re: A few questions about lite-C game development
[Re: kmega00]
#431183
10/10/13 19:41
10/10/13 19:41
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
Expert
|
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
This example from the manual isn't the best in my opinion. I will try a better one:
//#define USE_PHYSX3
#ifdef USE_PHYSX3
#include <ackphysx3.h>
#else
#include <ackphysx.h>
#endif
void create_physics_ent()
{
ENTITY* ent_tmp=ent_create(CUBE_MDL,nullvector,NULL);
#ifdef USE_PHYSX3
pX3ent_settype(ent_tmp,PH_RIGID,PH_BOX);
pX3ent_setdamping(ent_tmp,50,80);
pX3ent_setskinwidth(ent_tmp,0);
pX3ent_setiterations(ent_tmp,16);
pX3ent_setfriction(ent_tmp,100);
#else
pXent_settype(ent_tmp,PH_RIGID,PH_BOX);
pXent_setdamping(ent_tmp,50,80);
pXent_setskinwidth(ent_tmp,0);
pXent_setiterations(ent_tmp,16);
pXent_setfriction(ent_tmp,100);
#endif
}
In my example I use it to switch between A8 PhysX DLL and the Community PhysX3 DLL. I just have set or unset "#define USE_PHYSX3" and the whole code is changing.
|
|
|
|