CImage not displaying when compiled with Desktop

Discuss PocketC for Palm OS (including Desktop Edition)

CImage not displaying when compiled with Desktop

Postby kalisco on Wed Apr 16, 2008 8:52 pm

Hi.
Just started with PocketC.
Everything works fine when I compile on my Palm m500.
However when I compile on the desktop edition, the 3 CImages, ImgR, ImgP and ImgS are not visible.
They still react to stylus clicks as usual.
This happens on the emulator and the PDA with the PDB, PRC and standalone PRC versions.
Am I missing something ?

//RockPaperScissors.c
#include "Ccontrols.c"

@cid "STF1";
@name "RockPaperScissors";
@dbname "RockPaperScissors";

Chandle imgR,imgP,imgS;
int Choice[2];
string Options[3];
string RockImg=
"28000000000000000000000000000000000000000000001000000001fdedc000030719e001fc9019c003012557a0010000bc60031c126ea00835164fa00030014d2010404b9da010644ceba01d18f9e7c03f82a6cc407e7843da4062f9057d8049cd4e29004ae2c431005d307eb800537a3a960041ec1e640067e43b600064d7fc580048ec0cc400456f2e0400743caf90000fe43308000a053b8400123d070000104027840000a0dea8000fe1a63000010c5c000000001f6000000004000000000000000000000000";
string PaperImg=
"280000000000000000000008000000000ff0000000081db540600c0008bbc00800000040080000006009fc0000200407fde0200400013820000000002000000000100407e0001004183e0010000001e810040000061004000000100020000010023c1800100001fa0000020000a010020000170002000000100230000010022dff80000100000c100100004500010c00001001138080100100be70200100000c200100000020012795bc2001f80007e000800000700000000010000000000000000000000000000000";
string ScissorImg=
"280000000000000000000000000000000000000000000000000002000003001f000007803700000c806100001840408000204040c000204040600040006030004040301801804018180100400fe40500c0000407818000060467000003183c000001300000000120000000004000000000c0000000016000000001300000000010000000040800000008040000001802000000200100000040008000018000c00003000060000000002000000000300000000000000000000000000000000000000000000000000000";

init()
{
graph_on();
clearg();
imgR=Cimage(10,30,40,40);
Csetcontent(imgR,RockImg);
imgP=Cimage(60,30,40,40);
Csetcontent(imgP,PaperImg);
imgS=Cimage(110,30,40,40);
Csetcontent(imgS,ScissorImg);
Options[0]="Rock";
Options[1]="Paper";
Options[2]="Scissors";
}
DoPlayer(int Which)
{
int Evt;
int CarryOn=true;
textalign(11); //centred
text(80,120,"Player "+(Which+1));
text(80,140,"Make Your Choice");
while (CarryOn)
{
Evt=event(1);
CarryOn=false;
if (Cevent(imgR,Evt))
Choice[Which]=0;
else if (Cevent(imgP,Evt))
Choice[Which]=1;
else if (Cevent(imgS,Evt))
Choice[Which]=2;
else
CarryOn=true;
}
alert("You chose "+Options[Choice[Which]]);
}
StartGame()
{
Choice[0]=0;
Choice[1]=0;
graph_on();
title("Rock Paper Scissors");
clearg();
Cdraw(imgR);
Cdraw(imgP);
Cdraw(imgS);
DoPlayer(0);
DoPlayer(1);
}
ShowResult()
{
int Winner=2;
string Msg;
alert("The results are now in ...");
//graph_off();
//clear();
Msg="Player 1 chose "+
Options[Choice[0]]+"\n";
Msg=Msg+"Player 2 chose "+ Options[Choice[1]]+"\n";
if (Choice[0]==Choice[1])
Winner=0;
else
if ((Choice[0]==Choice[1]+1) ||
(Choice[0]==Choice[1]-2))
Winner=1;
if (Winner==0)
Msg=Msg+"It's a draw !";
else
Msg=Msg+"Player "+Winner
+" wins" ;
alert(Msg);
}
main()
{
init();
while(1)
{
StartGame();
ShowResult();
}
}
kalisco
 
Posts: 8
Joined: Wed Apr 16, 2008 8:15 pm

Okay - I've sorted it

Postby kalisco on Thu Apr 17, 2008 11:45 am

The problem was 2 different versions of Ccontrols.
The one on my Palm was generated by CEditor and was the older non-Color version.
The one on my desktop was the newer Color Ccontrols.
The newer one needs a call to Cinit(), the older one does not.
kalisco
 
Posts: 8
Joined: Wed Apr 16, 2008 8:15 pm


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 1 guest

cron