Scala Native SFML
Welcome to the Scala version of the SFML documentation, ported from the official documentation available on the SFML website. Here you will find a detailed view of all the SFML classes and functions.
If you are looking for tutorials, you can click on the "Docs" button of the sidebar.
Here is a short example, to show you how simple it is to use SFML:
import sfml.audio.*
import sfml.graphics.*
import sfml.window.*
@main def main =
/* Create the main window */
val window = RenderWindow(VideoMode((800, 600)), "SFML window")
/* Load a sprite to display */
val texture = Texture("cute_image.jpg")
val sprite = Sprite(texture)
/* Create a graphical text to display */
val font = Font("arial.ttf")
val text = Text(font, "Hello SFML", 50)
/* Start the game loop */
while window.isOpen() do
/* Process events */
for event <- window.pollEvent() do
event match
case Event.Closed() => window.close()
case _ => ()
/* Clear screen */
window.clear()
/* Draw the sprite */
window.draw(sprite)
/* Draw the string */
window.draw(text)
/* Update the window */
window.display()
Attributes
Members list
In this article