PDA

View Full Version : need help4game4nokix



joci2000
19-07-2005, 12:49 PM
Hi all,

I'm now trying to make a game for nokia phones.

This game will be called Lines (in MADos is Formula 1)
the aim of this game that you need to go along in a map without reach the dark place or the end of screen.

Here is the rules: So the actual line will show your "speed and direction". There will be a box after the end of line. this box show where it will go if you press any number. BUT only 1 pixel is allowed to "accelerate or brake AND turn" so you have to be careful if you want to go along the map.

And here is a questions about nokix.

1st. Is it possible to check a graphich pixel in nokia lcd? I mean that if i print some picture to the screen Could i check that is the line on the already drawn pixel or not?
I can check if i use inside map (car_map[48][84]...) instead of graphich file but it takes more place in flash file.

thx any help

yak
19-07-2005, 10:39 PM
you probably wanted to say it takes more space in RAM, not flash file :).

so, there is no function like get_pixel() or something (but it's a good idea to add one in next snapshot :D) but you can check the pixel in some way...

you're probably using freegfx system, after opening the screen you can call following function:

UBYTE *freegfx_buffer(void);

this function returns a pointer to the screen data of your currently opened freegfx screen. The data are organised in the same way as all nokia bitmap data, i.e. every byte describes a COLUMN of 8 pixels, 84 bytes describe a 84x8 box, 6 such boxes describe whole screen, 84*48/8=84*6=504 bytes.

an example get_pixel() function could look like this:


BOOL get_pixel(UBYTE x, UBYTE y)
{
UBYTE *data=freegfx_buffer();
return (BOOL)((*(data+x+(84*(y/8)))>>y%8)&1);
}
Please remember that I haven't checked that routine.

Wish you good luck!
[Yak]

joci2000
20-07-2005, 06:22 AM
you probably wanted to say it takes more space in RAM, not flash file :)....

Really thanks your answer ;)

And i was right it takes more space in flash, because the map looks like this in my way. it just a sample map:

const unsigned char car_map[48][84] = {
"###########################################",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"#..................................................................................#",
"###########################################",
};

And this way really takes a lot of free space in flash :cry:

Thx again your help :)

yak
20-07-2005, 09:40 AM
Oh, I see now.

I've check that routine - it works. On friday there will be next scripts snapshot (last before I leave to rest somwhere in the sun for a month) and it will include this function with prototype:

BOOL freegfx_get_pixel(UBYTE x, UBYTE y);

It will be part of freegfx system.

Thanks for idea.
[Yak]

joci2000
20-07-2005, 10:46 AM
WOW thanks the solution ;)
till friday i will do the other part of my game :)

and have a good holiday ;)

thx the updates

joci2000
20-07-2005, 03:26 PM
Sir Yak,

I have an other question:

Why is it that sometimes when i use freegfx some graphical command work properly for a time and after some keypress it doesn't? simply don't want to draw to the screen, while other work still properly

should i place a delay somewhere?

thx

joci2000
20-07-2005, 04:12 PM
Sorry for answering my question, but i found what was the problem.

It was my mistake :) i used two type for the same coordinate. :D

so there is no problem with freegfx

Daryl Saludares
22-07-2005, 06:36 AM
wish you good luck on your vacation sir yak... :lol:

yak
22-07-2005, 10:59 AM
@ joci2000

new snapshot is available, it contains the freegfx_get_pixel() function.

Cheers
[Yak]

http://nokix.pasjagsm.pl

joci2000
22-07-2005, 01:36 PM
@ joci2000

new snapshot is available, it contains the freegfx_get_pixel() function.

Cheers
[Yak]

http://nokix.pasjagsm.pl


Thanks so much ;)