Hi everyone
I've just released a small 2D engine using pspgl in C++. You can easily draw picture, move them change color,opacity and other things. The only thing that don't work is the sound. I've not found a good enough library to do so. This project was written for Windows Linux(i use OpenAL for sound) and i didn't find an as good as library. So there is no sound for this moment. But you can make games very easily.
Screenshot:
http://drcd.ifrance.com/screenege.PNG
http://drcd.ifrance.com/screenege2.png
Download:
http://drcd.ifrance.com/egePSP.rar.tga
After download just rename egePSP.rar.tga to egePSP.rar and unzip
Have fun
EGE: small 2d engine released
Here is a little explanation of class and what you can do with them.
First don't look files that are named xxx_Private.cpp\.h. You nedd them but you don't need to know what they do if you don't want to add functions.
--------------------------------------------------------------------------------
class EGECamera:
Description: Give functions to control pspgl camera.
Functions:
/*Set the position of the camera in 3D space*/
void SetEyePositionX(int x);
void SetEyePositionY(int y);
void SetEyePositionZ(int z);
void SetEyePosition(int x,int y,int z);
void SetEyePosition(EGEPOINT3D Pos);
/*Calculate an appopriate Z position for the camera depending of
the screen width (int x) the screen height (int y) and a view angle (float VA).
It returns a float which the new Z position.
*/
float CalculateEyePositionZ(int x, int y, float VA);
/*Getters for the camera position*/
int GetEyePositionX(void);
int GetEyePositionY(void);
int GetEyePositionZ(void);
EGEPOINT3D GetEyePosition(void);
/*Set the point that the camera looks*/
void SetLookPositionX(int x);
void SetLookPositionY(int y);
void SetLookPositionZ(int z);
void SetLookPosition(int x,int y,int z);
void SetLookPosition(EGEPOINT3D Pos);
/*Getters*/
int GetLookPositionX(void);
int GetLookPositionY(void);
int GetLookPositionZ(void);
EGEPOINT3D GetLookPosition(void);
--------------------------------------------------------------------------------
class EGEColor3,EGEColor4:
Description: Just 2 classes that describe the RGB and RGBA format.
--------------------------------------------------------------------------------
class EGEPOINT3D:
Description: Just a class that describe a point in 3D space.
--------------------------------------------------------------------------------
EGESPRITE:
Description: Give functions to create, draw or move a sprite to the screen
Functions:
/*Functions to draw sprites to the screen.*/
void Draw(int screenx,int screeny);
void Draw(EGEPOINT3D screenposition);
/*Functions to draw sprites centered on a point*/
void DrawCenterX(int screeny);
void DrawCenterY(int screenx);
void DrawCenter(void);
void DrawCenterAround(int screenx,int screeny);
/*Getters and Setters*/
int GetRealSizeX(void);
int GetRealSizeY(void);
int GetSizeX(void);
int GetSizeY(void);
/*With theses functions you can change the size of the sprites*/
void SetSizeX(int s);
void SetSizeY(int s);
const char* GetFilename(void);
/*Tells you if 2 sprites are collide and where they are collide*/
int IsCollideWith(EGESPRITE *Sprite);
/*Getters and Setters on the sprite position*/
EGEPOINT3D GetPosition(void);
void SetPosition(EGEPOINT3D Pos);
int GetPositionX(void);
void SetPositionX(int screenx);
int GetPositionY(void);
void SetPositionY(int screeny);
GLuint GetId(void);
/*With theses functions you can set the color/opacity of the sprite*/
void SetColor3(int r,int g,int b);
void SetColor3(EGECOLOR3);
EGECOLOR3 GetColor3(void);
void SetColor4(int r,int g,int b,int a);
void SetColor4(EGECOLOR4 c);
EGECOLOR4 GetColor4(void);
void SetOpacity(int alpha);
int GetOpacity(void);
int GetPositionZ(void);
void SetPositionZ(int screenz);
--------------------------------------------------------------------------------
class EGEFONT:
Description: Gives functions to draw personal font to the screen.
The font will not be a normal font .ttf. To create a font, just create each letter with paint or photoshop and save them as a png format with the.ttf
extension and save them in the same directory. Then, give the path of the directory to the create function and you should be able to use all functions.
Functions:
/*All theses functions are the same than EGESPRITE one's*/
void Draw(int x,int y,char *string);
void DrawSpec(int x,int y,char *string);
void SetColor3(int r,int g,int b);
void SetColor3(EGECOLOR3 c);
EGECOLOR3 GetColor3(void);
void SetColor4(int r,int g,int b,int a);
void SetColor4(EGECOLOR4 c);
EGECOLOR4 GetColor4(void);
void SetOpacity(int alpha);
int GetOpacity(void);
void SetSpecSizeX(int x);
void SetSpecSizeY(int y);
int GetSpecSizeX(void);
int GetSpecSizeY(void);
/*Set spacing between each letter*/
void SetSpacing(int s);
int GetSpacing(void);
--------------------------------------------------------------------------------
EGEKEYBOARD:
Description: Gives Getters to know if keys are pressed or not.
Functions:
/*Return true if the key passed to int k is pressed. Return false else*/
bool IsPressed(int k);
/*Give the number of key pressed*/
int GetNumberOfCharacterPressed(void);
/*Put all keys to a release state*/
void Reset(void);
void ForcePressingKeyDown(int k);
void ForcePressingKeyUp(int k);
--------------------------------------------------------------------------------
EGETIMER:
Description: Gives functions to control time.
Functions:
/*Stop program execution during a period. Usefull to set Gameloop period.*/
void Sleep(unsigned int mseconds);
/*Call run to function to start a chronometre*/
void Run(void);
/*Call stop function to stop it*/
void Stop(void);
/*Call GetTime to get the number of seconds between a call of run function and the stop one*/
clock_t GetTime(void);
First don't look files that are named xxx_Private.cpp\.h. You nedd them but you don't need to know what they do if you don't want to add functions.
--------------------------------------------------------------------------------
class EGECamera:
Description: Give functions to control pspgl camera.
Functions:
/*Set the position of the camera in 3D space*/
void SetEyePositionX(int x);
void SetEyePositionY(int y);
void SetEyePositionZ(int z);
void SetEyePosition(int x,int y,int z);
void SetEyePosition(EGEPOINT3D Pos);
/*Calculate an appopriate Z position for the camera depending of
the screen width (int x) the screen height (int y) and a view angle (float VA).
It returns a float which the new Z position.
*/
float CalculateEyePositionZ(int x, int y, float VA);
/*Getters for the camera position*/
int GetEyePositionX(void);
int GetEyePositionY(void);
int GetEyePositionZ(void);
EGEPOINT3D GetEyePosition(void);
/*Set the point that the camera looks*/
void SetLookPositionX(int x);
void SetLookPositionY(int y);
void SetLookPositionZ(int z);
void SetLookPosition(int x,int y,int z);
void SetLookPosition(EGEPOINT3D Pos);
/*Getters*/
int GetLookPositionX(void);
int GetLookPositionY(void);
int GetLookPositionZ(void);
EGEPOINT3D GetLookPosition(void);
--------------------------------------------------------------------------------
class EGEColor3,EGEColor4:
Description: Just 2 classes that describe the RGB and RGBA format.
--------------------------------------------------------------------------------
class EGEPOINT3D:
Description: Just a class that describe a point in 3D space.
--------------------------------------------------------------------------------
EGESPRITE:
Description: Give functions to create, draw or move a sprite to the screen
Functions:
/*Functions to draw sprites to the screen.*/
void Draw(int screenx,int screeny);
void Draw(EGEPOINT3D screenposition);
/*Functions to draw sprites centered on a point*/
void DrawCenterX(int screeny);
void DrawCenterY(int screenx);
void DrawCenter(void);
void DrawCenterAround(int screenx,int screeny);
/*Getters and Setters*/
int GetRealSizeX(void);
int GetRealSizeY(void);
int GetSizeX(void);
int GetSizeY(void);
/*With theses functions you can change the size of the sprites*/
void SetSizeX(int s);
void SetSizeY(int s);
const char* GetFilename(void);
/*Tells you if 2 sprites are collide and where they are collide*/
int IsCollideWith(EGESPRITE *Sprite);
/*Getters and Setters on the sprite position*/
EGEPOINT3D GetPosition(void);
void SetPosition(EGEPOINT3D Pos);
int GetPositionX(void);
void SetPositionX(int screenx);
int GetPositionY(void);
void SetPositionY(int screeny);
GLuint GetId(void);
/*With theses functions you can set the color/opacity of the sprite*/
void SetColor3(int r,int g,int b);
void SetColor3(EGECOLOR3);
EGECOLOR3 GetColor3(void);
void SetColor4(int r,int g,int b,int a);
void SetColor4(EGECOLOR4 c);
EGECOLOR4 GetColor4(void);
void SetOpacity(int alpha);
int GetOpacity(void);
int GetPositionZ(void);
void SetPositionZ(int screenz);
--------------------------------------------------------------------------------
class EGEFONT:
Description: Gives functions to draw personal font to the screen.
The font will not be a normal font .ttf. To create a font, just create each letter with paint or photoshop and save them as a png format with the.ttf
extension and save them in the same directory. Then, give the path of the directory to the create function and you should be able to use all functions.
Functions:
/*All theses functions are the same than EGESPRITE one's*/
void Draw(int x,int y,char *string);
void DrawSpec(int x,int y,char *string);
void SetColor3(int r,int g,int b);
void SetColor3(EGECOLOR3 c);
EGECOLOR3 GetColor3(void);
void SetColor4(int r,int g,int b,int a);
void SetColor4(EGECOLOR4 c);
EGECOLOR4 GetColor4(void);
void SetOpacity(int alpha);
int GetOpacity(void);
void SetSpecSizeX(int x);
void SetSpecSizeY(int y);
int GetSpecSizeX(void);
int GetSpecSizeY(void);
/*Set spacing between each letter*/
void SetSpacing(int s);
int GetSpacing(void);
--------------------------------------------------------------------------------
EGEKEYBOARD:
Description: Gives Getters to know if keys are pressed or not.
Functions:
/*Return true if the key passed to int k is pressed. Return false else*/
bool IsPressed(int k);
/*Give the number of key pressed*/
int GetNumberOfCharacterPressed(void);
/*Put all keys to a release state*/
void Reset(void);
void ForcePressingKeyDown(int k);
void ForcePressingKeyUp(int k);
--------------------------------------------------------------------------------
EGETIMER:
Description: Gives functions to control time.
Functions:
/*Stop program execution during a period. Usefull to set Gameloop period.*/
void Sleep(unsigned int mseconds);
/*Call run to function to start a chronometre*/
void Run(void);
/*Call stop function to stop it*/
void Stop(void);
/*Call GetTime to get the number of seconds between a call of run function and the stop one*/
clock_t GetTime(void);
-
- Posts: 71
- Joined: Fri May 05, 2006 5:59 pm
You don't have to do a main function. A main.cpp must looks like this:
Example: Draw a sprite on the screen
Code: Select all
#include "EGE.h"
void EGEInit(void)
{
//Function called once at the program start. Use it to initialize variables and create objects
}
void EGEGameLoop(void)
{
//Main game loop. Put code of your game here.
}
void EGEUninit(void)
{
//Function called once when the program stops. Use it to delete allocated memory
}
Code: Select all
#include "EGE.h"
EGESPRITE *Sprite;
void EGEInit(void)
{
Sprite=EGESPRITE::Create("yourpicture.png");//Load file in memory
//The picture format must be a .png.
}
void EGEGameLoop(void)
{
Sprite->Draw(0,0);//Draw picture at position (0,0) on the screen
}
void EGEUninit(void)
{
EGESAFE_DELETE(Sprite);//Free memory
}
Update:
I've fixed some bugs in classes EGESPRITE and EGELIST and new functions have been added.
The link to download is the same:
drcd.ifrance.com/egePSP.rar.tga
I've fixed some bugs in classes EGESPRITE and EGELIST and new functions have been added.
The link to download is the same:
drcd.ifrance.com/egePSP.rar.tga