-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds move for Shape, Oval, and Button. Shoes-level implementation and an SWT gui implementation. Oval is straghtforward. Shape is somewhat complicated because it moves all elements of the shape. I believe this is a correct, but not optimized implementation. Button is also complicated because Buttons can be laid out in slots. The Button is removed from the slot's layout, so the remaining elements can reflow. The Button's gui element is disposed, and a new gui element is created and added to a new Swt::Composite layer so it is out of the layout flow. This only happens on the first move. Once the Button is in a container without a layout, it continues to use the same gui element. Note that in this commit, the move method for button is on the button class itself. It belongs somewhere else, but I wasn't yet sure what else would have the same move semantics as button. * Add NO_BACKGROUND so layers are transparent. This applies to all flow objects * Adjust framerate to approach Red Shoes. It's still not a perfect match, but it's closer. * Add new working sample: simple-move.rb
- Loading branch information
1 parent
3b20b1a
commit 5008464
Showing
24 changed files
with
146 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ def initialize(opts={}, &blk) | |
|
||
self.opts = opts | ||
|
||
@app = self | ||
@style = DEFAULT_STYLE | ||
|
||
gui_init | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
require "spec_helper" | ||
require "shoes/spec_helper" | ||
|
||
#require 'support/shared_examples_for_common_elements_spec' | ||
|
||
describe Shoes::Button do | ||
|
||
#it_should_behave_like "A Common Element" | ||
let(:input_block) { Proc.new {} } | ||
let(:input_opts) { {:width => 131, :height => 137, :margin => 143} } | ||
subject { Shoes::Button.new("gui_container", "text", input_opts, input_block) } | ||
|
||
it_behaves_like "movable object" | ||
|
||
describe "initialize" do | ||
it "should set accessors" do | ||
input_block = lambda {} | ||
input_opts = {:width => 131, :height => 137, :margin => 143} | ||
button = Shoes::Button.new("gui_container", "text", input_opts, input_block) | ||
button = subject | ||
button.gui_container.should == "gui_container" | ||
button.click_event_lambda.should == input_block | ||
button.text.should == "text" | ||
button.width.should == 131 | ||
button.height.should == 137 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
shared_examples_for "movable object" do | ||
it "moves" do | ||
subject.move(300, 200) | ||
subject.left.should eq(300) | ||
subject.top.should eq(200) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require 'spec_helper' | ||
|
||
shared_examples = File.join(File.dirname(__FILE__), 'shared_examples', '**/*.rb') | ||
Dir[shared_examples].each { |f| puts "requiring #{f}"; require f } | ||
Dir[shared_examples].each { |f| require f } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
require 'spec_helper' | ||
require 'swt_shoes/spec_helper' | ||
|
||
describe SwtShoes::Animation do | ||
|
Oops, something went wrong.