librelist archives

« back to archive

Drawing Tokens with Shoes

Drawing Tokens with Shoes

From:
joe mick
Date:
2010-03-02 @ 17:51
Hi guys I really would like to thank you for all your help with my 
pervious question. I managed to draw my board for my shogi game, but am 
unable to draw the tokens on it. I would like to get you guys input on the
code and on how to draw tokens on it. my code is located in this 
repository 
 

http://code.google.com/p/cscshogi/source/detail?r=7fb62b3988a88486e4b2929aaece8fbe20025342
 
 


      

Re: [shoes] Drawing Tokens with Shoes

From:
Satoshi Asakawa
Date:
2010-03-03 @ 11:23
Hi joe,

Are you mentioning about this code?

http://code.google.com/p/cscshogi/source/browse/token.txt

If so, it seems that `Token.new` isn't called anywhere.
I'm not sure what Tokens are, though.

Could you explain a little more detail about your problem?

ashbb

Re: [shoes] Drawing Tokens with Shoes

From:
joe mick
Date:
2010-03-12 @ 06:36
alright am going to go a had and see this thing through. Thanks for all 
your help guys

--- On Wed, 3/3/10, i5m <i5ivem@googlemail.com> wrote:

From: i5m <i5ivem@googlemail.com>
Subject: Re: [shoes] Drawing Tokens with Shoes
To: shoes@librelist.com
Date: Wednesday, March 3, 2010, 10:20 AM

Have you had a look at expert-othello.rb in the Shoes samples 
directory? That would probably be of help.
I don't understand what the Token Class is doing. I assume you've just 
started on it and this will draw the pieces on the board?

Based on expert-othello.rb try putting this for the Shoes.app section:

Shoes.app :width => 520, :height => 600 do
  extend Shogi
 
  draw_board
  
  click { |button, x, y| 
    if coords = find_piece(x,y)
       begin
        draw_token(coords)
        draw_board
      rescue => e
        draw_board
        alert(e.message)
      end
    else
      # alert("Not a piece.")
    end
  }
  
end
And then add a method into the module:

def draw_token(coords)
	 GAME.board[coords[0]][coords[1]] = 1
end
And then also copy in the find_piece method from expert-othello.rb The 
co-ordinates will be off, but it will get things drawing on the screen.

-----------------------

i5m.co.uk
GPG Key: 0xA18A602B



On Tue, Mar 2, 2010 at 5:51 PM, joe mick <moomed2003@yahoo.com> wrote:

Hi guys I really would like to thank you for all your help with my 
pervious question. I managed to draw my board for my shogi game, but am 
unable to draw the tokens on it. I would like to get you guys input on the
code and on how to draw tokens on it. my code is located in this 
repository 

 

http://code.google.com/p/cscshogi/source/detail?r=7fb62b3988a88486e4b2929aaece8fbe20025342

 
 




      




      

Re: [shoes] Drawing Tokens with Shoes

From:
joe mick
Date:
2010-03-05 @ 19:41
my problem is that am trying to draw a token, but I can't. I wrote a code 
in the if statement of drew_board to make a oval shape piece. the code on 
the bottom for the token class was a desperate measure to see if anything 
happen, you could properly ignore it. all am trying to do is draw the code
in the If statement. if you can adjust  the code as much as you like and 
get it to draw the piece i'll be in forever debt to you guys.   

--- On Wed, 3/3/10, Satoshi Asakawa <ashbbb@gmail.com> wrote:

From: Satoshi Asakawa <ashbbb@gmail.com>
Subject: Re: [shoes] Drawing Tokens with Shoes
To: shoes@librelist.com
Date: Wednesday, March 3, 2010, 6:23 AM

Hi joe,

Are you mentioning about this code?

http://code.google.com/p/cscshogi/source/browse/token.txt

If so, it seems that `Token.new` isn't called anywhere.

I'm not sure what Tokens are, though.

Could you explain a little more detail about your problem?

ashbb





      

Re: [shoes] Drawing Tokens with Shoes

From:
Satoshi Asakawa
Date:
2010-03-06 @ 06:40
Hi joe,

Try to the following snippet.
I guess you can see black or white tokens on the board.
I'm not sure it's useful for Shogi game, though.


Shoes.app :width => 520, :height => 600 do
  extend Shogi
  draw_board
  every do |t|
    GAME.board[t%5][t%5] = 1 + rand(2)
    draw_board
  end
end

Regards,
ashbb

Re: [shoes] Drawing Tokens with Shoes

From:
i5m
Date:
2010-03-03 @ 15:20
Have you had a look at expert-othello.rb in the Shoes samples
directory? That would probably be of help.

I don't understand what the Token Class is doing. I assume you've just
started on it and this will draw the pieces on the board?

Based on expert-othello.rb try putting this for the Shoes.app section:

Shoes.app :width => 520, :height => 600 do

  extend Shogi



  draw_board



  click { |button, x, y|

    if coords = find_piece(x,y)

       begin

        draw_token(coords)

        draw_board

      rescue => e

        draw_board

        alert(e.message)

      end

    else

      # alert("Not a piece.")

    end

  }



end


And then add a method into the module:

def draw_token(coords)

 GAME.board[coords[0]][coords[1]] = 1

end


And then also copy in the find_piece method from expert-othello.rb The
co-ordinates will be off, but it will get things drawing on the screen.


-----------------------
i5m.co.uk
GPG Key: 0xA18A602B


On Tue, Mar 2, 2010 at 5:51 PM, joe mick <moomed2003@yahoo.com> wrote:

> Hi guys I really would like to thank you for all your help with my pervious
> question. I managed to draw my board for my shogi game, but am unable to
> draw the tokens on it. I would like to get you guys input on the code and on
> how to draw tokens on it. my code is located in this repository
>
>
> 
http://code.google.com/p/cscshogi/source/detail?r=7fb62b3988a88486e4b2929aaece8fbe20025342
>
>
>
>