Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

I can make a hello world application in BREW using C language but how can i make this application using C++ if anyone have any sample code then plz help me........

Some tips
First of all your app's main structure is the same, the objects are included inside it
e.g
// 1st Case, static objects
#include "CString.h" // your header class
typedef struct _app
{
AEEApplet a;
IShell *pIShell; // Apuntador a IShell
IDisplay *pIDisplay; // Apuntador a
}myapp;
================================= In other file
// CString.h
class CString
{
public:
static void Draw_Text(IDisplay *pIDisplay, AEEFont Font,const char *Text,int X, int Y, RGBVAL Color);
.............................
;
============= In other file
//CString.cpp
void CString:: Draw_Text(IDisplay *pIDisplay,AEEFont Font,const char *Text, int X, int Y, RGBVAL Color)
{
AECHAR Buffer[128];
MEMSET(Buffer,'\0',sizeof(Buffer));
STRTOWSTR(Texto,Buffer,sizeof(Buffer));
IDISPLAY_SetColor(pIDisplay,CLR_USER_TEXT,Color);
IDISPLAY_DrawText(pIDisplay,Font,Buffer,-1,X,Y,0,0);
IDISPLAY_Update(pIDisplay);

// Using from your app your_app.cpp
case EVT_APP_START:
CString:: Draw_Text(pMe->pIDisplay,AEE_FONT_NORMAL,"Hello World", 50,50,RGB_BLACK);
return TRUE;
And so forth ......
// 2nd case, dynamic objects
#include "CString.h" // your header class
typedef struct _app
{
AEEApplet a;
IShell *pIShell; // Apuntador a IShell
IDisplay *pIDisplay; // Apuntador a
CString *string_obj; // the object
}myapp;
/// CString.h
class CString
{
public:
void Draw_Text(IDisplay *pIDisplay, AEEFont Font,const char *Text,int X, int Y, RGBVAL Color);
.............................
;
// Using from your code:
case EVT_APP_START:
pMe->string_obj.Draw_Text(pMe->pIDisplay,AEE_FONT_NORMAL,"Hello World", 50,50,RGB_BLACK);
return TRUE;
In the 2nd case you must consider things such as create and destroy objects ...
Hope it helps
Zainos

Some tips
First of all your app's main structure is the same, the objects are included inside it
e.g
// 1st Case, static objects
#include "CString.h" // your header class
typedef struct _app
{
AEEApplet a;
IShell *pIShell; // Apuntador a IShell
IDisplay *pIDisplay; // Apuntador a
}myapp;
================================= In other file
// CString.h
class CString
{
public:
static void Draw_Text(IDisplay *pIDisplay, AEEFont Font,const char *Text,int X, int Y, RGBVAL Color);
.............................
;
============= In other file
//CString.cpp
void CString:: Draw_Text(IDisplay *pIDisplay,AEEFont Font,const char *Text, int X, int Y, RGBVAL Color)
{
AECHAR Buffer[128];
MEMSET(Buffer,'\0',sizeof(Buffer));
STRTOWSTR(Texto,Buffer,sizeof(Buffer));
IDISPLAY_SetColor(pIDisplay,CLR_USER_TEXT,Color);
IDISPLAY_DrawText(pIDisplay,Font,Buffer,-1,X,Y,0,0);
IDISPLAY_Update(pIDisplay);

// Using from your app your_app.cpp
case EVT_APP_START:
CString:: Draw_Text(pMe->pIDisplay,AEE_FONT_NORMAL,"Hello World", 50,50,RGB_BLACK);
return TRUE;
And so forth ......
// 2nd case, dynamic objects
#include "CString.h" // your header class
typedef struct _app
{
AEEApplet a;
IShell *pIShell; // Apuntador a IShell
IDisplay *pIDisplay; // Apuntador a
CString *string_obj; // the object
}myapp;
/// CString.h
class CString
{
public:
void Draw_Text(IDisplay *pIDisplay, AEEFont Font,const char *Text,int X, int Y, RGBVAL Color);
.............................
;
// Using from your code:
case EVT_APP_START:
pMe->string_obj.Draw_Text(pMe->pIDisplay,AEE_FONT_NORMAL,"Hello World", 50,50,RGB_BLACK);
return TRUE;
In the 2nd case you must consider things such as create and destroy objects ...
Hope it helps
Zainos