Hello world/Graphical: Difference between revisions
sort
imported>Ahk user (Added example Autohotkey V2) |
(sort) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1,256:
RETURN
</syntaxhighlight>▼
require "crsfml"
window = SF::RenderWindow.new(SF::VideoMode.new(800, 600), "Hello world/Graphical")
# A font file(s) MUST be in the directory of the Crystal file itself.
# CrSFML does NOT load font files from the filesystem root!
font = SF::Font.from_file("DejaVuSerif-Bold.ttf")
text = SF::Text.new
text.font = font
text.string = "Goodbye, world!"
text.character_size = 24
text.color = SF::Color::Black
while window.open?
while event = window.poll_event
if event.is_a? SF::Event::Closed
window.close
end
end
window.clear(SF::Color::White)
window.draw(text)
window.display
end
</syntaxhighlight>
Line 1,530 ⟶ 1,566:
}
</syntaxhighlight>
=={{header|Fennel}}==
{{libheader|LÖVE}}
<syntaxhighlight lang="fennel">
(fn love.load []▼
(love.window.setMode 300 300 {"resizable" false})▼
(love.window.setTitle "Hello world/Graphical in Fennel!"))▼
(let [str "Goodbye, World!"]▼
(fn love.draw []▼
(love.graphics.print str 95 150)))▼
</syntaxhighlight>
To run this, you need to have LÖVE installed in your machine, and then run this command <code>fennel --compile love_test.fnl > main.lua; love .</code>. Since LÖVE has no compatibility with Fennel, we need to AOT-compile the file to a Lua file called <code>main.lua</code>, so then LÖVE can execute the program.
=={{header|Forth}}==
Line 1,611 ⟶ 1,660:
Compile with
<code>gfortran gtk2_mini.f90 -o gtk2_mini.x `pkg-config --cflags --libs gtk-2-fortran`</code>
▲=={{header|Fennel}}==
▲==={{libheader|LÖVE}}===
▲<syntaxhighlight lang="fennel">
▲(fn love.load []
▲ (love.window.setMode 300 300 {"resizable" false})
▲ (love.window.setTitle "Hello world/Graphical in Fennel!"))
▲(let [str "Goodbye, World!"]
▲ (fn love.draw []
▲ (love.graphics.print str 95 150)))
▲</syntaxhighlight>
▲To run this, you need to have LÖVE installed in your machine, and then run this command <code>fennel --compile love_test.fnl > main.lua; love .</code>. Since LÖVE has no compatibility with Fennel, we need to AOT-compile the file to a Lua file called <code>main.lua</code>, so then LÖVE can execute the program.
=={{header|FreeBASIC}}==
|