1. BGTE 2 and Bitmaps

Hi Guys
David Your BGTE 2 is great can not wait for the final ver,also can not wait
for 3?????(hint,hint)
I need some help I am trying to write a program an PGN READER it reads
chess moves,but the proublm is that I don't know how to make the chess
pieces move,I have the chess board as a bitmap,do I make the chess pieces
bitmap's too? if anyone has code that I can look at that would help

Thanks
David Mosley

new topic     » topic index » view message » categorize

2. Re: BGTE 2 and Bitmaps

On Tue, 20 May 1997, Scott Stubberud wrote:
>
> Hi Guys
> David Your BGTE 2 is great can not wait for the final ver,also can not wait
> for 3?????(hint,hint)
> I need some help I am trying to write a program an PGN READER it reads
> chess moves,but the proublm is that I don't know how to make the chess
> pieces move,I have the chess board as a bitmap,do I make the chess pieces
> bitmap's too? if anyone has code that I can look at that would help

yes, you make each piece an individual bitmap and move them
independently on the board.  You'd use the sprite techniques we've
discussed on here to mask the pieces against the background.  I can send
you some code to do that stuff if ya want. (gotta dig up some chess piece
images)

Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria

new topic     » goto parent     » topic index » view message » categorize

3. Re: BGTE 2 and Bitmaps

> David Your BGTE 2 is great can not wait for the final ver,also can not
wait
> for 3?????(hint,hint)

I'm glad you liked the tutorial :)....but 3 ???? Yeeaaargh!!! Not for at
least another year! ;>..this tutorial has been a lot of work :>

> I need some help I am trying to write a program an PGN READER it reads
> chess moves,but the proublm is that I don't know how to make the chess
> pieces move,I have the chess board as a bitmap,do I make the chess pieces
> bitmap's too? if anyone has code that I can look at that would help

You can make the chess pieces bitmaps or from creating a sequence made up
of sequences right inside your program. Each atom element of each sequence
element in the sequence represents the pixel colour.

Movement is simply repeating the following steps in a loop:

-saving the background the chesspiece is going to cover using save_image(),

-displaying the chesspiece for a certain amount of time using
display_image(),
-restoring the saved background using display_image(),
-adjusting the upper left x and y corner by the appropriate positive or
negative increment.

This only works with shapes that have a rectangular border however. If you
want an example of overlaying an irregular shape over a background, I can
send you some code on how I placed the index menu over the background in
ABGTE2. It is based on the suggestion Jacques Deschenes and Michael Bolin
offered two months ago that uses and_bits() and or_bits().

David

new topic     » goto parent     » topic index » view message » categorize

4. Re: BGTE 2 and Bitmaps

Scott Stubberud wrote:

> I need some help I am trying to write a program an PGN READER it reads
> chess moves,but the proublm is that I don't know how to make the chess
> pieces move,I have the chess board as a bitmap,do I make the chess pieces
> bitmap's too? if anyone has code that I can look at that would help

Small help:
1.- Display the chess board image (use read_bitmap & display_image)
2.- Save the "square" here the piece should be, using save_image()
3.- Display the piece (as a bitmap) in its position
4.- When you wanna move the piece, just display the "saved" square of the board
(it should overwrite the pice)
5.- Repeat from step 2 to redraw the piece in another location.

Hope it helps you.

Bye,
--

            ************************************
            This message sent by Daniel Berstein
            ************************************
     email: architek at geocities.com
 homepages: http://www.geocities.com/SiliconValley/Heights/9316
            http://www.cybercity.hko.net/silicon_valley/architek

new topic     » goto parent     » topic index » view message » categorize

5. Re: BGTE 2 and Bitmaps

David Alan Gay wrote:
> > David Your BGTE 2 is great can not wait for the final ver,also can not
> wait
> > for 3?????(hint,hint)
>
> I'm glad you liked the tutorial :)....but 3 ???? Yeeaaargh!!! Not for at
> least another year! ;>..this tutorial has been a lot of work :>

What if I paid you $1,000,000? (Hypothetical, of course. Simply brain
candy. I can barely afford to upgrade to 1.5!)

> want an example of overlaying an irregular shape over a background, I can
> send you some code on how I placed the index menu over the background in
> ABGTE2. It is based on the suggestion Jacques Deschenes and Michael Bolin
> offered two months ago that uses and_bits() and or_bits().

I'm assuming said offered suggestion was in some kind of machine code. I
had, at one time, reduced the display of an object with "see through"
pixels to about two or three lines. I forget where that code is, but if
anybody's interested I'll try to post it somewhere on the internet.

Later!
ck lester

P.S. I'm not tracking dates or times very well, but I assume since Mr.
Packard is responding to messages that he is forsaking his desire to
leave the Euphoria scene. Or maybe I came in during a big joke and I
still haven't gotten the punch-line... :)

new topic     » goto parent     » topic index » view message » categorize

6. Re: BGTE 2 and Bitmaps

> I'm assuming said offered suggestion was in some kind of machine code. I
> had, at one time, reduced the display of an object with "see through"
> pixels to about two or three lines. I forget where that code is, but if
> anybody's interested I'll try to post it somewhere on the internet.

No, it's written entirely in Euphoria. I despise Assembler ;)....and it is
only a few lines of code. Quite simple really.

-- load index screen image
bitmap_data = read_bitmap("indexscr.bmp")
index_image = bitmap_data[2]

-- load index screen mask
--(white surrounding a black shadow of the index screen image)
bitmap_data = read_bitmap("indexneg.bmp")
index_neg = bitmap_data[2]

-- save area of screen image screen is going to overlay
lower_right = {upper_left[1] + 404,upper_left[2] + 318}
saved_screen = save_image(upper_left, lower_right)

-- AND saved background with index screen mask
-- OR   result from AND to index_image
work_image = and_bits(saved_screen,index_neg)
index_image = or_bits(work_image,index_image)

-- display resulting AND/OR'ed image.
display_image(upper_left,index_image)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu