forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

EGE: small 2d engine released

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
drcd



Joined: 04 Dec 2005
Posts: 22

PostPosted: Sun Jun 25, 2006 11:05 pm    Post subject: EGE: small 2d engine released Reply with quote

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
Back to top
View user's profile Send private message
drcd



Joined: 04 Dec 2005
Posts: 22

PostPosted: Mon Jun 26, 2006 8:42 pm    Post subject: Reply with quote

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);
Back to top
View user's profile Send private message
Zettablade



Joined: 05 May 2006
Posts: 71

PostPosted: Tue Jun 27, 2006 6:33 am    Post subject: Reply with quote

looks interesting. hope you get sound support in there soon.
Back to top
View user's profile Send private message
drcd



Joined: 04 Dec 2005
Posts: 22

PostPosted: Tue Jun 27, 2006 6:43 am    Post subject: Reply with quote

Well, on the PC release there is a class for sound using OpenAL but i don't know what to use for psp. I thought using SDL but i had multi thread problem on the pc release that's why i choosed OpenAL. So if you know a good library ,i'll do it.
Back to top
View user's profile Send private message
drcd



Joined: 04 Dec 2005
Posts: 22

PostPosted: Tue Jun 27, 2006 6:55 am    Post subject: Reply with quote

You don't have to do a main function. A main.cpp must looks like this:
Code:

#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
}


Example: Draw a sprite on the screen

Code:

#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
}
Back to top
View user's profile Send private message
drcd



Joined: 04 Dec 2005
Posts: 22

PostPosted: Tue Jul 04, 2006 1:01 am    Post subject: Reply with quote

Update:
I've fixed some bugs in classes EGESPRITE and EGELIST and new functions have been added.
The link to download is the same:
[url]drcd.ifrance.com/egePSP.rar.tga[/url]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group