Ultimate Lib - Library A

Kohaku's picture

I'm designing a library of functions that can be used to quickly produce projects without having to either continually glue together random functions from other projects or create them each time from scratch.

Once the library has been created, it will then be implemented into the AGE engine, replacing all of the current commands.

Current areas and commands:

  1. //3D
  2. //creation/deletion
  3. objectNumber = loadObject(fileName$)
  4. deleteObject(objectNumber)
  5.  
  6. //movement/rotation
  7. positionObject(objectNumber, x#, y#, z#)
  8. rotateObject(objectNumber, x#, y#, z#)
  9. xRotateObject(objectNumber, x#)
  10. yRtateObject(objectNumber, y#)
  11. zRotateObject(objectNumber, z#)
  12.  
  13. //animation commands
  14.  
  15. //visual modes
  16. motionBlur(intensityPercent)
  17.  
  18. //collision/physics modes
  19.  
  20. //2D
  21. imageNumber = loadImage(fileName$)
  22.  
  23. //GUI
  24. GUIHandle = makeWindow(xPosition, yPosition, xSize, ySize, text$, parentHandle)
  25. GUIHandle = makePanel(xPosition, yPosition, xSize, ySize, text$, parentHandle)
  26. GUIHandle = makeButton(xPosition, yPosition, xSize, ySize, text$, parentHandle)
  27. GUIHandle = makeButton(xPosition, yPosition, xSize, ySize, text$, parentHandle)
  28.  
  29. GUIText$ = getGUIText(GUIHandle)
  30. setGUIText(GUIHandle)
  31.  
  32. deleteGUI(GUIHandle)
  33.  
  34. //Multiplayer
  35. connected = netConnect(ip$)
  36.  
  37. netDisconnect()
  38.  
  39. //System
  40. //AGE only
  41. runInitialScript : runs all code within <runInitialScript></runInitialScript> tags.
  42. runLoopScript : runs all code within <runLoopScript></runLoopScript> tags.
  43. runEndScript : runs all code within <runEndScript></runEndScript> tags.
  44.  
  45. //timer
  46. systemUptime()
  47.  
  48. timerHandle = createTimer()
  49. getTimer(timerHandle)
  50. stopTimer(timerHandle)
  51. resetTimer(timerHandle)
  52. deleteTimer(timerHandle)
  53.  
  54. //Math
  55.  
  56.  
  57. //String
  58.  
  59.  
  60. //File
  61.  
  62.  
  63. //AI

Please feed through your suggested areas and functions to be added. This first post will be updated to reflect any additions to the library design.

Needs timer
Merlin's picture

Needs timer handeling:

create timer returns a timer ID/object
then a pause, stop and reset commands that are part of the object or take the ID

Interesting! Can you give me
Kohaku's picture

Interesting!

Can you give me some example function names so I can better understand it?

I am assuming this is for
Merlin's picture

I am assuming this is for Dark Basic rather than an OOP language (although if you are going to write it in C++ or GDK then it isnt too difficult, Ill give a short example of that too)

int CreateNewTimer:

This is something that counts miliseconds, (I'm not sure what the DB command to do this is but im sure you can find a way). All this function will do is tell the program that there is going to be a new timer and returns the ID.

StartTimer(int Timer ID)

This will take the ID of the timer that you would like to start counting miliseconds and starts it going

StopTimer(int Timer ID)

This will tell it to stop counting miliseconds (probably not going to be needed but worth adding for a sence of completion)

ResetTimer(int Timer ID)

Resets the timer, ie sets its value to 0;

In GDK or C++ simply place these functions within a class

class Timer
{
private:
unsigned int m_Time;
bool m_Stopped;

public:
Timer() { m_Time = 0; m_Stopped = false } // Constructor basically your CreateNewTimer function
~Timer() // Destructor, required to destroy the object

void SetTime(int Time) { m_Timer = Time; }
bool GetStopped() { return m_Stopped; }

void StopTimer() { m_Stopped = true; }
void StartTimer() { m_Stopped = false; }
void ResetTimer() { m_Time = 0; }

};

int main()
{
Timer MyTimer;
while (true)
{
//unsigned int Time = GetTheTime;
if (!MyTimer.GetStopped)
MyTimer.SetTime(Time);
}
return 0;
}

I hope this clears things up a bit for you Smiling

Added.
Kohaku's picture

Added.

I find a simple way of
Merlin's picture

I find a simple way of switching between windowed and full screen is a useful asset to a libary as well, although it is possible to do it in SDL i havnt really tested it as i think you have to delete the graphics engine then recreate it to go full screen which sounds like a scarey experience!

P.S. I just read my last comment back, man what was i thinking? Patronising or what? sorry mate...didn't mean it.

S'alright.
Kohaku's picture

S'alright. Eye-wink

Added an AI section now. I
Kohaku's picture

Added an AI section now. I want the engine to have path-finding capabilities.

Sweet
Merlin's picture

Sweet Smiling