Mercurial > hg > charamega
changeset 13:21bc7e1d1429
Compiles with Mirah 0.1.0.
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Tue, 05 Mar 2013 18:18:06 +0400 |
parents | 6e272c520bc6 |
children | 9726d78eb848 |
files | src/net/kryshen/charamega/field.mirah src/net/kryshen/charamega/game.mirah src/net/kryshen/charamega/ui.mirah |
diffstat | 3 files changed, 13 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/net/kryshen/charamega/field.mirah Tue Jul 17 08:16:34 2012 +0400 +++ b/src/net/kryshen/charamega/field.mirah Tue Mar 05 18:18:06 2013 +0400 @@ -171,7 +171,7 @@ g.rotate card.angle * v - card_bounds.setRect(-card_size / 2, -card_size / 2, + card_bounds.setRect(0 - card_size / 2, 0 - card_size / 2, card_size, card_size) if f > 0 @@ -196,8 +196,8 @@ g.scale scale, scale if scale < 1.0 g.drawGlyphVector(gv, - -float(gb.getX + gb.getWidth / 2), - -float(gb.getY + gb.getHeight / 2)) + 0 - float(gb.getX + gb.getWidth / 2), + 0 - float(gb.getY + gb.getHeight / 2)) g.setTransform save_t_2 end @@ -215,13 +215,13 @@ x += cw end - + y += rh end end - private - + #private + def hit(x:int, y:int) insets = getInsets size = getSize
--- a/src/net/kryshen/charamega/game.mirah Tue Jul 17 08:16:34 2012 +0400 +++ b/src/net/kryshen/charamega/game.mirah Tue Mar 05 18:18:06 2013 +0400 @@ -52,7 +52,7 @@ self.players = 1 end - def shuffle + def ensure_shuffled return false if @shuffled shuffle @cards.size / 2 @@ -91,7 +91,7 @@ end def start:void - shuffle + ensure_shuffled @shuffled = false @matches.length.times { |i| @matches[i] = 0 } @@ -290,7 +290,7 @@ true end - def hit(x:int, y:int, w:int, h:int) + def hit(x:int, y:int, w:int, h:int):Card return nil if x < 0 or y < 0 layout = layout(w, h) @@ -319,7 +319,7 @@ @version = properties.getProperty("version") end - private + #private def compute_limits pairs = @cards.size / 2
--- a/src/net/kryshen/charamega/ui.mirah Tue Jul 17 08:16:34 2012 +0400 +++ b/src/net/kryshen/charamega/ui.mirah Tue Mar 05 18:18:06 2013 +0400 @@ -32,7 +32,7 @@ end def initialize(root_pane:JRootPane) - super LayoutManager(BorderLayout.new) + setLayout BorderLayout.new @game = Game.new.shuffle(30) @field = Field.new(@game) @@ -103,7 +103,7 @@ end end - private + #private def create_status ui = self @@ -175,7 +175,7 @@ players.addChangeListener do |e| game.players = players.getNumber.intValue - field.repaint if game.shuffle + field.repaint if game.ensure_shuffled ui.update_status end