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

Developer

Forums

Forums:

Actually I was developing a TIC TAC TOE game in BREW.what was happening was when I press right ,left,up,or down keys movement was happening.....but the problem was that i was unable to see anything .Now m using EraseFrm to erase the previous contents....so that i can see the movements......but for key 5 its has to be there fixed at that place......but it is also getting erased..... :)

Can any one please help!!!

Can any one please help!!!

amey_brew wrote:Can any one please help!!!
Please explain your problem more clearly. Like what do you want to happen and Why for key 5 its has to be there fixed at that place.
The more clearer the problem is, the faster you will get the answer from the members in the forum. ;)

amey_brew wrote:Can any one please help!!!
Please explain your problem more clearly. Like what do you want to happen and Why for key 5 its has to be there fixed at that place.
The more clearer the problem is, the faster you will get the answer from the members in the forum. ;)

Actually what is happening is that when i press up ,down,right,left arrow keys...
movement of 'X' and 'o' is happening...but i am unable to see any thing on the screen...some indication should be there na to let the user see ki that at this now the cursor is right now..... :confused:

Actually what is happening is that when i press up ,down,right,left arrow keys...
movement of 'X' and 'o' is happening...but i am unable to see any thing on the screen...some indication should be there na to let the user see ki that at this now the cursor is right now..... :confused:

amey_brew wrote:Actually what is happening is that when i press up ,down,right,left arrow keys...
movement of 'X' and 'o' is happening...but i am unable to see any thing on the screen...some indication should be there na to let the user see ki that at this now the cursor is right now..... :confused:
Do you call IDISPLAY_Update(); at the end of the painting routine? It is required to update the screen.
If you not able to identify the problem, then post in the code snippet.

amey_brew wrote:Actually what is happening is that when i press up ,down,right,left arrow keys...
movement of 'X' and 'o' is happening...but i am unable to see any thing on the screen...some indication should be there na to let the user see ki that at this now the cursor is right now..... :confused:
Do you call IDISPLAY_Update(); at the end of the painting routine? It is required to update the screen.
If you not able to identify the problem, then post in the code snippet.

case AVK_UP:
{
if(ypos < 40)
ypos = 100;
else
ypos = ypos - 30;
if(flag_to_changeXO==0)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos,ypos + 30,15,15);
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
/*
code for drawing frames
rc1.x=rc1.x;
rc1.y-=rc1.dy;
rc1.dx = 30;
rc1.dy = 30;
IDISPLAY_FrameRect(pMe->pIDisplay,&rc1);
IDISPLAY_Update(pMe->pIDisplay);*/
}
case AVK_LEFT:
{
if(xpos < 24)
xpos = 84;
else
xpos = xpos - 30;
/*IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);*/
if(flag_to_changeXO==0)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos + 30,ypos,15,15);
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
/*{
for drawing frames
rc1.x-=rc1.dx;
rc1.y=rc1.y;
rc1.dx = 30;
rc1.dy = 30;
IDISPLAY_FrameRect(pMe->pIDisplay,&rc1);
IDISPLAY_Update(pMe->pIDisplay);
}*/
}
case AVK_RIGHT:
{
if(xpos > 84)
xpos = 24;
else
xpos = xpos + 30;
/*IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos - 30,ypos,15,15);*/
if(flag_to_changeXO==0)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos - 30,ypos,15,15);
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
/*IDISPLAY_EraseRect(pMe->pIDisplay, &rc);
rc1.x=rc1.x + rc1.dx;
rc1.y=rc1.y;
rc1.dx = 30;
rc1.dy = 30;
// IDISPLAY_FrameRect(pMe->pIDisplay,&rc1);
IDISPLAY_DrawFrame(pMe->pIDisplay,&rc1,AEE_FT_BOX,RGB_WHITE);
IDISPLAY_Update(pMe->pIDisplay);*/
}
case AVK_DOWN:
{
if(ypos > 100)
ypos = 40;
else
ypos = ypos + 30;
/*IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);*/
if(flag_to_changeXO==0)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos,ypos - 30,15,15);
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
/*{
rc1.x=rc1.x;
rc1.y+=rc1.dy;
rc1.dx = 30;
rc1.dy = 30;
IDISPLAY_FrameRect(pMe->pIDisplay,&rc1);
IDISPLAY_Update(pMe->pIDisplay);
}*/
}
case AVK_5:
if(flag == 0 )
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
szWhoPlays1,
-1,
9,
120,
NULL,
NULL);
if(xpos >=24 && xpos <=84) //| (ypos >=24 && ypos <=100))
{
if(ypos >=40 && ypos <=100)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
//IDISPLAY_DrawFrame(pMe->pIDisplay, &rc1, AEE_FT_NONE,MAKE_RGB(255,255,255));
IDISPLAY_Update(pMe->pIDisplay);
flag++;
flag_to_changeXO++;
flag_to_keep++;
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
}
}
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
szWhoPlays,
-1,
9,
120,
NULL,
NULL);
if(xpos >=9 && xpos <=99) //| (ypos >=24 && ypos <=100))
{
if(ypos >=25 && ypos <=115)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
//IDISPLAY_Update(pMe->pIDisplay);
flag = 0;
flag_to_changeXO = 0;
//flag_to_keep=0;
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
}
}
}
}
}
return(TRUE);

case AVK_UP:
{
if(ypos < 40)
ypos = 100;
else
ypos = ypos - 30;
if(flag_to_changeXO==0)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos,ypos + 30,15,15);
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
/*
code for drawing frames
rc1.x=rc1.x;
rc1.y-=rc1.dy;
rc1.dx = 30;
rc1.dy = 30;
IDISPLAY_FrameRect(pMe->pIDisplay,&rc1);
IDISPLAY_Update(pMe->pIDisplay);*/
}
case AVK_LEFT:
{
if(xpos < 24)
xpos = 84;
else
xpos = xpos - 30;
/*IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);*/
if(flag_to_changeXO==0)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos + 30,ypos,15,15);
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
/*{
for drawing frames
rc1.x-=rc1.dx;
rc1.y=rc1.y;
rc1.dx = 30;
rc1.dy = 30;
IDISPLAY_FrameRect(pMe->pIDisplay,&rc1);
IDISPLAY_Update(pMe->pIDisplay);
}*/
}
case AVK_RIGHT:
{
if(xpos > 84)
xpos = 24;
else
xpos = xpos + 30;
/*IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos - 30,ypos,15,15);*/
if(flag_to_changeXO==0)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos - 30,ypos,15,15);
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
/*IDISPLAY_EraseRect(pMe->pIDisplay, &rc);
rc1.x=rc1.x + rc1.dx;
rc1.y=rc1.y;
rc1.dx = 30;
rc1.dy = 30;
// IDISPLAY_FrameRect(pMe->pIDisplay,&rc1);
IDISPLAY_DrawFrame(pMe->pIDisplay,&rc1,AEE_FT_BOX,RGB_WHITE);
IDISPLAY_Update(pMe->pIDisplay);*/
}
case AVK_DOWN:
{
if(ypos > 100)
ypos = 40;
else
ypos = ypos + 30;
/*IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);*/
if(flag_to_changeXO==0)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
IDISPLAY_Update(pMe->pIDisplay);
}
IDISPLAY_EraseRgn(pMe->pIDisplay, xpos,ypos - 30,15,15);
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
/*{
rc1.x=rc1.x;
rc1.y+=rc1.dy;
rc1.dx = 30;
rc1.dy = 30;
IDISPLAY_FrameRect(pMe->pIDisplay,&rc1);
IDISPLAY_Update(pMe->pIDisplay);
}*/
}
case AVK_5:
if(flag == 0 )
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
szWhoPlays1,
-1,
9,
120,
NULL,
NULL);
if(xpos >=24 && xpos <=84) //| (ypos >=24 && ypos <=100))
{
if(ypos >=40 && ypos <=100)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
xText,
-1,
xpos,
ypos,
NULL,
NULL);
//IDISPLAY_DrawFrame(pMe->pIDisplay, &rc1, AEE_FT_NONE,MAKE_RGB(255,255,255));
IDISPLAY_Update(pMe->pIDisplay);
flag++;
flag_to_changeXO++;
flag_to_keep++;
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
}
}
}
else
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
szWhoPlays,
-1,
9,
120,
NULL,
NULL);
if(xpos >=9 && xpos <=99) //| (ypos >=24 && ypos <=100))
{
if(ypos >=25 && ypos <=115)
{
IDISPLAY_DrawText(pMe->pIDisplay,
AEE_FONT_BOLD,
oText,
-1,
xpos,
ypos,
NULL,
NULL);
//IDISPLAY_Update(pMe->pIDisplay);
flag = 0;
flag_to_changeXO = 0;
//flag_to_keep=0;
IDISPLAY_Update(pMe->pIDisplay);
return(TRUE);
}
}
}
}
}
return(TRUE);

Actually m trying to develop a tic tac toe game of human vs computer....
Can anyone help how to start with......
any sample codes
pls
;)

Actually m trying to develop a tic tac toe game of human vs computer....
Can anyone help how to start with......
any sample codes
pls
;)

It is better to club all the painting code into a single method, rather than having them around in all key event handling code.
A few hints on how to start:
1) Declare an array of integers like int gameValues[9], which will be used to store the user inputs and that of the auto-player.
2) Declare a variable to hold the current active cell, and another to hold who's turn its now.
2) Initialize the array to some value like -1 to represent that its an empty cell [1 can be used to denote X and 2 for O.]
3) In the Key Event handling routine just update the current active cell's index for arrow keys and update with appropriate values[1 or 2] in the array when selected.
4). Write the paint code in a way that it clears the entire screen, paints the board and a loop which scans thru the array and paints the values in the cells accordingly. And atlast don't forget to add IDisplay_Update() at the end of the paint().
5). After handling each event, call paint() as needed.
You can introduce the autoplayer's logic inbetween after the user's move has been updated, which can use the array for computing the autoplayer's move.
HTH ;)

It is better to club all the painting code into a single method, rather than having them around in all key event handling code.
A few hints on how to start:
1) Declare an array of integers like int gameValues[9], which will be used to store the user inputs and that of the auto-player.
2) Declare a variable to hold the current active cell, and another to hold who's turn its now.
2) Initialize the array to some value like -1 to represent that its an empty cell [1 can be used to denote X and 2 for O.]
3) In the Key Event handling routine just update the current active cell's index for arrow keys and update with appropriate values[1 or 2] in the array when selected.
4). Write the paint code in a way that it clears the entire screen, paints the board and a loop which scans thru the array and paints the values in the cells accordingly. And atlast don't forget to add IDisplay_Update() at the end of the paint().
5). After handling each event, call paint() as needed.
You can introduce the autoplayer's logic inbetween after the user's move has been updated, which can use the array for computing the autoplayer's move.
HTH ;)

I developed a TIC TAC TOE game of two players.But now i got a problem when the game gets over and if we want to start the game again we will have to run the emulator again.....
Any ways so that I can play new game again n again in my application ..without running the emulator again n again.....
please help.......
Thanks in advance!!! :confused:

I developed a TIC TAC TOE game of two players.But now i got a problem when the game gets over and if we want to start the game again we will have to run the emulator again.....
Any ways so that I can play new game again n again in my application ..without running the emulator again n again.....
please help.......
Thanks in advance!!! :confused:

amey_brew wrote:I developed a TIC TAC TOE game of two players.But now i got a problem when the game gets over and if we want to start the game again we will have to run the emulator again.....
Any ways so that I can play new game again n again in my application ..without running the emulator again n again.....
:confused:
i dunt understand what is the problem ur facing here, if u need to start up the game again just bring on to the main screen rite after the game over, then start up with the new game, so there is no necessary to restart the application

amey_brew wrote:I developed a TIC TAC TOE game of two players.But now i got a problem when the game gets over and if we want to start the game again we will have to run the emulator again.....
Any ways so that I can play new game again n again in my application ..without running the emulator again n again.....
:confused:
i dunt understand what is the problem ur facing here, if u need to start up the game again just bring on to the main screen rite after the game over, then start up with the new game, so there is no necessary to restart the application

hi
thanks 4 ur reply........but I didnt get how to bring it back to the main screen after the game gets over......how it should be done....
can u pls explain in bit detail........... :confused:

hi
thanks 4 ur reply........but I didnt get how to bring it back to the main screen after the game gets over......how it should be done....
can u pls explain in bit detail........... :confused:

When the game is finished, you can just clear/re-intialize the array and call paint() again. That will be enough to reset the game.
You can define the entire game as a state machine with states like GameMenu, GamsScreen, HelpScreen, etc. Based on the keypress on each screen, update the state machine or the screen contents appropriately.

When the game is finished, you can just clear/re-intialize the array and call paint() again. That will be enough to reset the game.
You can define the entire game as a state machine with states like GameMenu, GamsScreen, HelpScreen, etc. Based on the keypress on each screen, update the state machine or the screen contents appropriately.

hi
Sorry I a unable to understand how to do that.........
When my game gets over I just want to start a new game again...without again compling,linking n running the emulator.So what changes should I do in the program......
Can u please tell me.....
If possible give any code snipet showing that.........
Thanks in Advance!!!
:confused:

hi
Sorry I a unable to understand how to do that.........
When my game gets over I just want to start a new game again...without again compling,linking n running the emulator.So what changes should I do in the program......
Can u please tell me.....
If possible give any code snipet showing that.........
Thanks in Advance!!!
:confused:

hi
Can anyone tell me how to display a message box in a BREW application........
Thanks in advance!!! ;)

hi
Can anyone tell me how to display a message box in a BREW application........
Thanks in advance!!! ;)

You can use the help of Istatic interface or draw your own custom dialog box with the fillrect, drawtext, etc.
There is also an option to create Dialogbox in the resource editor... But I have never used that ;) .

You can use the help of Istatic interface or draw your own custom dialog box with the fillrect, drawtext, etc.
There is also an option to create Dialogbox in the resource editor... But I have never used that ;) .

There is an API ISHELL_MessageBox() available.I am using it but its not displaying the message box.Can u please check it n tell me. What should be the second parameter to it........... :)

There is an API ISHELL_MessageBox() available.I am using it but its not displaying the message box.Can u please check it n tell me. What should be the second parameter to it........... :)

amey_brew wrote:There is an API ISHELL_MessageBox() available.I am using it but its not displaying the message box.Can u please check it n tell me. What should be the second parameter to it........... :)
You can use this for displaying the message in messagebox.
ISHELL_MessageBoxText()
Description:
This function instructs the AEE Shell to display a message box to the device user. A message box is a simple window with a title and text. The device user dismisses it using the END or CLR keys. Unlike ISHELL_MessageBox(), this function uses the title and text strings provided.
Prototype:
boolean ISHELL_MessageBoxText
(
IShell * pIShell,
const AECHAR * pTitle,
const AECHAR * pText
)
Parameters:
pIShell Pointer to the IShell Interface object.
pTitle Pointer to the title string.
pText Pointer to the text string.

amey_brew wrote:There is an API ISHELL_MessageBox() available.I am using it but its not displaying the message box.Can u please check it n tell me. What should be the second parameter to it........... :)
You can use this for displaying the message in messagebox.
ISHELL_MessageBoxText()
Description:
This function instructs the AEE Shell to display a message box to the device user. A message box is a simple window with a title and text. The device user dismisses it using the END or CLR keys. Unlike ISHELL_MessageBox(), this function uses the title and text strings provided.
Prototype:
boolean ISHELL_MessageBoxText
(
IShell * pIShell,
const AECHAR * pTitle,
const AECHAR * pText
)
Parameters:
pIShell Pointer to the IShell Interface object.
pTitle Pointer to the title string.
pText Pointer to the text string.