mirror of
https://github.com/SFML/SFML.git
synced 2024-11-29 06:41:05 +08:00
7e42a2b505
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1722 4e206d99-4929-0410-ac5d-dfc041789085
34 lines
708 B
Ruby
34 lines
708 B
Ruby
require 'sfml/system'
|
|
require 'sfml/window'
|
|
require 'sfml/graphics'
|
|
|
|
app = SFML::RenderWindow.new
|
|
app.create( [800, 600], "My Ruby SFML" )
|
|
app.framerate = 100
|
|
app.position = [300, 300]
|
|
input = app.input
|
|
|
|
shape = SFML::Shape.rectangle( [-10, -10, 20, 20], SFML::Color::White )
|
|
|
|
image = SFML::Image.new
|
|
image.create( 100, 100, [255, 0, 0] )
|
|
sprite = SFML::Sprite.new( image, [500, 500] )
|
|
|
|
text = SFML::Text.new( "This is a test!" )
|
|
text.position = [ 20, 20 ]
|
|
|
|
while app.open?
|
|
while event = app.get_event
|
|
if event.type == SFML::Event::Closed
|
|
app.close
|
|
end
|
|
end
|
|
|
|
app.clear
|
|
shape.position = [input.mouseX, input.mouseY]
|
|
app.draw shape
|
|
app.draw sprite
|
|
app.draw text
|
|
app.display
|
|
end
|