how to use sleep in c++ brew | developer.brewmp.com how to use sleep in c++ brew | developer.brewmp.com

Developer

how to use sleep in c++ brew

Forums:

hi all,
can anyone help ,,how to use sleep method in c++ in brew..in my ball program the ball in moving very fastly,,i would like to move it slowly..please help me in doing this,,,tanx

How you are moving the ball???
Using a timer??
If yes....then increase the timer value...thats it.

How you are moving the ball???
Using a timer??
If yes....then increase the timer value...thats it.

No i am changing x,y values
while(true)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
}
and in ballObj...........
int Ball::getXPos(int16 x)
{
if(x==(screenWidth+BallXPos)) IncX=false;
if(x==BallXPos) IncX=true;
if(IncX) return ++x;
else return --x;

int Ball::getYPos(int16 y)
{
if(y==(screenHeight+BallYPos)) IncY=false;
if(y==(BallYPos)) IncY=true;
if(IncY) return ++y;
else return --y;

In this case how can i slow down the ball

No i am changing x,y values
while(true)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
}
and in ballObj...........
int Ball::getXPos(int16 x)
{
if(x==(screenWidth+BallXPos)) IncX=false;
if(x==BallXPos) IncX=true;
if(IncX) return ++x;
else return --x;

int Ball::getYPos(int16 y)
{
if(y==(screenHeight+BallYPos)) IncY=false;
if(y==(BallYPos)) IncY=true;
if(IncY) return ++y;
else return --y;

In this case how can i slow down the ball

Hi,
Use "int ISHELL_SetTimer(IShell * pIShell, int32 dwMSecs,PFNNOTIFY pfn, void * User)" API.
I think this will help you

Hi,
Use "int ISHELL_SetTimer(IShell * pIShell, int32 dwMSecs,PFNNOTIFY pfn, void * User)" API.
I think this will help you

Use the follwoing code
while(true)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
ISHELL_SetTimer(pi->a.m_pIShell, 500, , pi);

and in ballObj...........
int Ball::getXPos(int16 x)
{
if(x==(screenWidth+BallXPos)) IncX=false;
if(x==BallXPos) IncX=true;
if(IncX) return ++x;
else return --x;

int Ball::getYPos(int16 y)
{
if(y==(screenHeight+BallYPos)) IncY=false;
if(y==(BallYPos)) IncY=true;
if(IncY) return ++y;
else return -

Use the follwoing code
while(true)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
ISHELL_SetTimer(pi->a.m_pIShell, 500, , pi);

and in ballObj...........
int Ball::getXPos(int16 x)
{
if(x==(screenWidth+BallXPos)) IncX=false;
if(x==BallXPos) IncX=true;
if(IncX) return ++x;
else return --x;

int Ball::getYPos(int16 y)
{
if(y==(screenHeight+BallYPos)) IncY=false;
if(y==(BallYPos)) IncY=true;
if(IncY) return ++y;
else return -

But my function is like.........
boolean ShapeApp::HandleEvent(ShapeApp * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEDeviceInfo di={0};
ISHELL_GetDeviceInfo( pi->m_pIShell, &di );
switch (eCode)
{
case EVT_APP_START:
pi->screenWidth=di.cxScreen;
pi->screenHeight=di.cyScreen;
AEERect Rect;
Rect.x = 0;
Rect.y = 0;
Rect.dx =pi->screenWidth;
Rect.dy = pi->screenHeight;
while(true)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
ISHELL_SetTimer(pi->m_pIShell, 50000,(PFNNOTIFY)HandleEvent, pi);
}
return(TRUE);
case EVT_APP_STOP:
return(TRUE);
default:
break;
}
return(FALSE);

As u told,i made my prg like above but there is no change..

But my function is like.........
boolean ShapeApp::HandleEvent(ShapeApp * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEDeviceInfo di={0};
ISHELL_GetDeviceInfo( pi->m_pIShell, &di );
switch (eCode)
{
case EVT_APP_START:
pi->screenWidth=di.cxScreen;
pi->screenHeight=di.cyScreen;
AEERect Rect;
Rect.x = 0;
Rect.y = 0;
Rect.dx =pi->screenWidth;
Rect.dy = pi->screenHeight;
while(true)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
ISHELL_SetTimer(pi->m_pIShell, 50000,(PFNNOTIFY)HandleEvent, pi);
}
return(TRUE);
case EVT_APP_STOP:
return(TRUE);
default:
break;
}
return(FALSE);

As u told,i made my prg like above but there is no change..

boolean ShapeApp::HandleEvent(ShapeApp * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEDeviceInfo di={0};
ISHELL_GetDeviceInfo( pi->m_pIShell, &di );
switch (eCode)
{
case EVT_APP_START:
pi->screenWidth=di.cxScreen;
pi->screenHeight=di.cyScreen;
Animate(pi);
return(TRUE);
case EVT_APP_STOP:
return(TRUE);
default:
break;
}
return(FALSE);

void Animate(ShapeApp* pi)
{
AEERect Rect;
Rect.x = 0;
Rect.y = 0;
Rect.dx =pi->screenWidth;
Rect.dy = pi->screenHeight;
while(TRUE)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
ISHELL_SetTimer(pi->m_pIShell, 500,(PFNNOTIFY)Animate, pi);
}

Try this program

boolean ShapeApp::HandleEvent(ShapeApp * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEDeviceInfo di={0};
ISHELL_GetDeviceInfo( pi->m_pIShell, &di );
switch (eCode)
{
case EVT_APP_START:
pi->screenWidth=di.cxScreen;
pi->screenHeight=di.cyScreen;
Animate(pi);
return(TRUE);
case EVT_APP_STOP:
return(TRUE);
default:
break;
}
return(FALSE);

void Animate(ShapeApp* pi)
{
AEERect Rect;
Rect.x = 0;
Rect.y = 0;
Rect.dx =pi->screenWidth;
Rect.dy = pi->screenHeight;
while(TRUE)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
ISHELL_SetTimer(pi->m_pIShell, 500,(PFNNOTIFY)Animate, pi);
}

Try this program

//ShapeApp.h
#define ShapeApp_h
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEGraphics.h"
#include "Ball.h"
class ShapeApp :public AEEApplet
{
public:
AEEApplet a;
IImage* pImage;
IImage* pBrickImage;
IImage* pPedalImage;
static void Animate(ShapeApp* pi);
ShapeApp();
static boolean HandleEvent(ShapeApp * pApp, AEEEvent eCode, uint16 wparam, uint32 dwParam);
static boolean initAppData(IApplet * pIApplet);
static void freeAppData(ShapeApp * pApp);
AEERect * pRect;
protected:
void freeData();
boolean initData();
private:
Ball *BallObj;
int16 screenWidth;
int16 screenHeight;
int16 x;
int16 y;
int16 XPos,YPos;
;
#endif
//ShapeApp.cpp
#include "ShapeApp.h"
#include "ShapeApp.bid"
#include "AEEImage.h"
#include "monster_res.h"
#include "AEEStdLib.h"
extern "C"
{
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
{
*ppObj = NULL;
if(ClsId == AEECLSID_SHAPEAPP)
{
if(AEEApplet_New(sizeof(ShapeApp), ClsId, pIShell,po,(IApplet**)ppObj,
(AEEHANDLER)ShapeApp::HandleEvent,(PFNFREEAPPDATA)ShapeApp::freeAppData))
{
if(ShapeApp::initAppData((IApplet *) *ppObj))
{
return (AEE_SUCCESS);
}
}
}
return (EFAILED);

boolean ShapeApp::HandleEvent(ShapeApp * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEDeviceInfo di={0};
ISHELL_GetDeviceInfo( pi->m_pIShell, &di );
switch (eCode)
{
case EVT_APP_START:
pi->screenWidth=di.cxScreen;
pi->screenHeight=di.cyScreen;
Animate(pi);
return(TRUE);
case EVT_APP_STOP:
return(TRUE);
default:
break;
}
return(FALSE);

void ShapeApp:: Animate(ShapeApp* pi)
{
AEERect Rect;
Rect.x = 0;
Rect.y = 0;
Rect.dx =pi->screenWidth;
Rect.dy = pi->screenHeight;
while(true)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_SetDrawSize(pi->pImage,1000,1000);
IDISPLAY_DrawRect(pi->m_pIDisplay,&Rect, 0, MAKE_RGB(225,225,225), IDF_RECT_FILL);
IIMAGE_Draw(pi->pPedalImage,pi->BallObj->pedalObj->getPedalXPos(),pi->BallObj->pedalObj->getPedalYPos());
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
ISHELL_SetTimer(pi->m_pIShell, 500,(PFNNOTIFY)Animate, pi);
}

boolean ShapeApp::initAppData(IApplet * pIApplet)
{
return ((ShapeApp *) pIApplet)->initData();

void ShapeApp::freeAppData(ShapeApp * pApp)
{
pApp->freeData();

boolean ShapeApp::initData()
{
AEEDeviceInfo di={0};
ISHELL_GetDeviceInfo(this->m_pIShell, &di );
this->screenWidth=di.cxScreen;
this->screenHeight=di.cyScreen;
this->pImage = ISHELL_LoadImage(this->m_pIShell,"Balls_5.png");
AEEImageInfo pBallInfo={0};
IIMAGE_GetInfo(this->pImage,&pBallInfo) ;
//IIMAGE_SetDrawSize(this->pImage,100,100);
//IIMAGE_SetParm(this->pImage,IPARM_SIZE ,100,100);
DBGPRINTF("%d %d",pBallInfo.cx,pBallInfo.cy);
this->pBrickImage = ISHELL_LoadImage(this->m_pIShell,"Bricks_0.png");
AEEImageInfo pBrickInfo={0};
IIMAGE_GetInfo(this->pBrickImage,&pBrickInfo) ;
this->pPedalImage = ISHELL_LoadImage(this->m_pIShell,"pedal.bmp");
AEEImageInfo pPedalInfo={0};
IIMAGE_GetInfo(this->pPedalImage,&pPedalInfo) ;
//DBGPRINTF("%d %d",pPedalInfo.cx,pPedalInfo.cy);
BallObj=new Ball(di.cxScreen,di.cyScreen,pPedalInfo.cx,pPedalInfo.cy);
this->x=-50;
this->y=0;
return TRUE;

void ShapeApp::freeData()
{
}
ShapeApp::ShapeApp()
{
}
//Ball.h
#if !defined(Ball_h)
#define Ball_h
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h"
#include "AEEStdLib.h"
#include "AEEGraphics.h"
#include "Pedal.h"
#define BallXPos -50
#define BallYPos 0
class Ball:public AEEApplet
{
//~Ball();
public:
Ball();
Ball(int16,int16,int16,int16);
int getXPos(int16);
int getYPos(int16);
Pedal *pedalObj;
private:
int16 pedalWidth;
int16 pedalHeight;
int16 screenWidth;
int16 screenHeight;
boolean IncX;
boolean IncY;
int16 sleep;
int32 x,y;
};
#endif
//Ball.cpp
#include "Ball.h"
Ball::Ball(int16 screenWidth, int16 screenHeight,int16 pedalWidth,int16 pedalHeight)
{
this->screenWidth=screenWidth;
this->screenHeight=screenHeight;
this->pedalWidth=pedalWidth;
this->pedalHeight=pedalHeight;
pedalObj=new Pedal(screenWidth,screenHeight,pedalWidth,pedalHeight);

int Ball::getXPos(int16 x)
{
if(x==(screenWidth+BallXPos))
IncX=false;
if(x==BallXPos)
IncX=true;
if(IncX)
return ++x;
else
return --x;
}
int Ball::getYPos(int16 y)
{
if(y==(screenHeight+BallYPos))
IncY=false;
if(y==(BallYPos))
IncY=true;
if(IncY)
return ++y;
else
return --y;
}
//Pedal.h
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h"
#include "AEEStdLib.h"
#include "AEEGraphics.h"
class Pedal:public AEEApplet
{
public:
Pedal(int16,int16,int16,int16);
int getPedalXPos();
int getPedalYPos();
private:
int16 screenWidth;
int16 screenHeight;
int16 pedalWidth;
int16 pedalHeight;
;
#endif
/Pedal.cpp
#include "Pedal.h"
Pedal::Pedal(int16 screenWidth, int16 screenHeight,int16 pedalWidth,int16 pedalHeight)
{
this->screenWidth=screenWidth;
this->screenHeight=screenHeight;
this->pedalWidth=pedalWidth;
this->pedalHeight=pedalHeight;
}
int Pedal::getPedalXPos()
{
return 0;
}
int Pedal::getPedalYPos()
{
return (this->screenHeight-this->pedalHeight);
}
this is my program in this one i am getting animation but it is very fast and also i am not able to put any events to move my pedal.Plz tel me how can i get good results?

//ShapeApp.h
#define ShapeApp_h
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEGraphics.h"
#include "Ball.h"
class ShapeApp :public AEEApplet
{
public:
AEEApplet a;
IImage* pImage;
IImage* pBrickImage;
IImage* pPedalImage;
static void Animate(ShapeApp* pi);
ShapeApp();
static boolean HandleEvent(ShapeApp * pApp, AEEEvent eCode, uint16 wparam, uint32 dwParam);
static boolean initAppData(IApplet * pIApplet);
static void freeAppData(ShapeApp * pApp);
AEERect * pRect;
protected:
void freeData();
boolean initData();
private:
Ball *BallObj;
int16 screenWidth;
int16 screenHeight;
int16 x;
int16 y;
int16 XPos,YPos;
;
#endif
//ShapeApp.cpp
#include "ShapeApp.h"
#include "ShapeApp.bid"
#include "AEEImage.h"
#include "monster_res.h"
#include "AEEStdLib.h"
extern "C"
{
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
{
*ppObj = NULL;
if(ClsId == AEECLSID_SHAPEAPP)
{
if(AEEApplet_New(sizeof(ShapeApp), ClsId, pIShell,po,(IApplet**)ppObj,
(AEEHANDLER)ShapeApp::HandleEvent,(PFNFREEAPPDATA)ShapeApp::freeAppData))
{
if(ShapeApp::initAppData((IApplet *) *ppObj))
{
return (AEE_SUCCESS);
}
}
}
return (EFAILED);

boolean ShapeApp::HandleEvent(ShapeApp * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEDeviceInfo di={0};
ISHELL_GetDeviceInfo( pi->m_pIShell, &di );
switch (eCode)
{
case EVT_APP_START:
pi->screenWidth=di.cxScreen;
pi->screenHeight=di.cyScreen;
Animate(pi);
return(TRUE);
case EVT_APP_STOP:
return(TRUE);
default:
break;
}
return(FALSE);

void ShapeApp:: Animate(ShapeApp* pi)
{
AEERect Rect;
Rect.x = 0;
Rect.y = 0;
Rect.dx =pi->screenWidth;
Rect.dy = pi->screenHeight;
while(true)
{
pi->x=pi->BallObj->getXPos(pi->x);
pi->y=pi->BallObj->getYPos(pi->y);
IIMAGE_SetDrawSize(pi->pImage,1000,1000);
IDISPLAY_DrawRect(pi->m_pIDisplay,&Rect, 0, MAKE_RGB(225,225,225), IDF_RECT_FILL);
IIMAGE_Draw(pi->pPedalImage,pi->BallObj->pedalObj->getPedalXPos(),pi->BallObj->pedalObj->getPedalYPos());
IIMAGE_Draw(pi->pImage,pi->x,pi->y);
IDISPLAY_UpdateEx(pi->m_pIDisplay,false);
ISHELL_SetTimer(pi->m_pIShell, 500,(PFNNOTIFY)Animate, pi);
}

boolean ShapeApp::initAppData(IApplet * pIApplet)
{
return ((ShapeApp *) pIApplet)->initData();

void ShapeApp::freeAppData(ShapeApp * pApp)
{
pApp->freeData();

boolean ShapeApp::initData()
{
AEEDeviceInfo di={0};
ISHELL_GetDeviceInfo(this->m_pIShell, &di );
this->screenWidth=di.cxScreen;
this->screenHeight=di.cyScreen;
this->pImage = ISHELL_LoadImage(this->m_pIShell,"Balls_5.png");
AEEImageInfo pBallInfo={0};
IIMAGE_GetInfo(this->pImage,&pBallInfo) ;
//IIMAGE_SetDrawSize(this->pImage,100,100);
//IIMAGE_SetParm(this->pImage,IPARM_SIZE ,100,100);
DBGPRINTF("%d %d",pBallInfo.cx,pBallInfo.cy);
this->pBrickImage = ISHELL_LoadImage(this->m_pIShell,"Bricks_0.png");
AEEImageInfo pBrickInfo={0};
IIMAGE_GetInfo(this->pBrickImage,&pBrickInfo) ;
this->pPedalImage = ISHELL_LoadImage(this->m_pIShell,"pedal.bmp");
AEEImageInfo pPedalInfo={0};
IIMAGE_GetInfo(this->pPedalImage,&pPedalInfo) ;
//DBGPRINTF("%d %d",pPedalInfo.cx,pPedalInfo.cy);
BallObj=new Ball(di.cxScreen,di.cyScreen,pPedalInfo.cx,pPedalInfo.cy);
this->x=-50;
this->y=0;
return TRUE;

void ShapeApp::freeData()
{
}
ShapeApp::ShapeApp()
{
}
//Ball.h
#if !defined(Ball_h)
#define Ball_h
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h"
#include "AEEStdLib.h"
#include "AEEGraphics.h"
#include "Pedal.h"
#define BallXPos -50
#define BallYPos 0
class Ball:public AEEApplet
{
//~Ball();
public:
Ball();
Ball(int16,int16,int16,int16);
int getXPos(int16);
int getYPos(int16);
Pedal *pedalObj;
private:
int16 pedalWidth;
int16 pedalHeight;
int16 screenWidth;
int16 screenHeight;
boolean IncX;
boolean IncY;
int16 sleep;
int32 x,y;
};
#endif
//Ball.cpp
#include "Ball.h"
Ball::Ball(int16 screenWidth, int16 screenHeight,int16 pedalWidth,int16 pedalHeight)
{
this->screenWidth=screenWidth;
this->screenHeight=screenHeight;
this->pedalWidth=pedalWidth;
this->pedalHeight=pedalHeight;
pedalObj=new Pedal(screenWidth,screenHeight,pedalWidth,pedalHeight);

int Ball::getXPos(int16 x)
{
if(x==(screenWidth+BallXPos))
IncX=false;
if(x==BallXPos)
IncX=true;
if(IncX)
return ++x;
else
return --x;
}
int Ball::getYPos(int16 y)
{
if(y==(screenHeight+BallYPos))
IncY=false;
if(y==(BallYPos))
IncY=true;
if(IncY)
return ++y;
else
return --y;
}
//Pedal.h
#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h"
#include "AEEStdLib.h"
#include "AEEGraphics.h"
class Pedal:public AEEApplet
{
public:
Pedal(int16,int16,int16,int16);
int getPedalXPos();
int getPedalYPos();
private:
int16 screenWidth;
int16 screenHeight;
int16 pedalWidth;
int16 pedalHeight;
;
#endif
/Pedal.cpp
#include "Pedal.h"
Pedal::Pedal(int16 screenWidth, int16 screenHeight,int16 pedalWidth,int16 pedalHeight)
{
this->screenWidth=screenWidth;
this->screenHeight=screenHeight;
this->pedalWidth=pedalWidth;
this->pedalHeight=pedalHeight;
}
int Pedal::getPedalXPos()
{
return 0;
}
int Pedal::getPedalYPos()
{
return (this->screenHeight-this->pedalHeight);
}
this is my program in this one i am getting animation but it is very fast and also i am not able to put any events to move my pedal.Plz tel me how can i get good results?

First off, you really need to put that in code tags, it's very difficult to read.
In ShapeApp:: Animate() you need to take out the while(TRUE). The point of adding the ISHELL_SetTimer() is that BREW will call Animate again after the time that you set, so you don't need the infinite loop.
This doesn't cause you phone to reset? Look up the "watchdog timer" to see why infinite loops are very bad in BREW.

First off, you really need to put that in code tags, it's very difficult to read.
In ShapeApp:: Animate() you need to take out the while(TRUE). The point of adding the ISHELL_SetTimer() is that BREW will call Animate again after the time that you set, so you don't need the infinite loop.
This doesn't cause you phone to reset? Look up the "watchdog timer" to see why infinite loops are very bad in BREW.

hi,
i am new to BREW.So i dont know so many things so onlt i hav uased this while loop now i came to know what to use.But still i am not clear plz tel me can we use Threads in BREW?
and also can you plz tel me "if(AEEApplet_New(sizeof(ShapeApp), ClsId, pIShell,po,(IApplet**)ppObj,(AEEHANDLER)ShapeApp::HandleEvent,(PFNFREEAPPDATA)ShapeApp::freeAppData))" what does it mean?I know little bit but i need clear discription in this plz tel me..........

hi,
i am new to BREW.So i dont know so many things so onlt i hav uased this while loop now i came to know what to use.But still i am not clear plz tel me can we use Threads in BREW?
and also can you plz tel me "if(AEEApplet_New(sizeof(ShapeApp), ClsId, pIShell,po,(IApplet**)ppObj,(AEEHANDLER)ShapeApp::HandleEvent,(PFNFREEAPPDATA)ShapeApp::freeAppData))" what does it mean?I know little bit but i need clear discription in this plz tel me..........

Yes, you can use threads in BREW. Have a look at IThread for more information. Be aware that BREW threads are cooperative though, so you will have to release control back to BREW regularly. You will still not be able to use unbroken infinite loops even with BREW IThreads.
I do have to ask, though, is there any reason why you want to use threads instead of BREW timers? Either one will work, but it seems like you are closer to getting it to work with timers right now than with IThread. Have you tried taking out while(true) and seeing if that works?
As for AEEApplet_New(), are you asking what AEEApplet_New does or what each of the arguments is for?

Yes, you can use threads in BREW. Have a look at IThread for more information. Be aware that BREW threads are cooperative though, so you will have to release control back to BREW regularly. You will still not be able to use unbroken infinite loops even with BREW IThreads.
I do have to ask, though, is there any reason why you want to use threads instead of BREW timers? Either one will work, but it seems like you are closer to getting it to work with timers right now than with IThread. Have you tried taking out while(true) and seeing if that works?
As for AEEApplet_New(), are you asking what AEEApplet_New does or what each of the arguments is for?