You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Julia wrapper for CSFML, the official binding of SFML for C. SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network. The Julia bindings in this repo are auto-generated using Clang.jl.
Installation
pkg> add CSFML
Quick start
using CSFML
using CSFML.LibCSFML
mode =sfVideoMode(1280, 720, 32)
window =sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, C_NULL)
@assert window !=C_NULL
texture =sfTexture_createFromFile(joinpath(dirname(pathof(CSFML)), "..", "examples", "julia-tan.png"), C_NULL)
@assert texture !=C_NULL
sprite =sfSprite_create()
sfSprite_setTexture(sprite, texture, sfTrue)
font =sfFont_createFromFile(joinpath(dirname(pathof(CSFML)), "..", "examples", "Roboto-Bold.ttf"))
@assert font !=C_NULL
text =sfText_create()
sfText_setString(text, "Hello SFML")
sfText_setFont(text, font)
sfText_setCharacterSize(text, 50)
music =sfMusic_createFromFile(joinpath(dirname(pathof(CSFML)), "..", "examples", "Chrono_Trigger.ogg"))
@assert music !=C_NULLsfMusic_play(music)
event_ref =Ref{sfEvent}()
whileBool(sfRenderWindow_isOpen(window))
# process eventswhileBool(sfRenderWindow_pollEvent(window, event_ref))
# close window : exit
event_ref.x.type == sfEvtClosed &&sfRenderWindow_close(window)
end# clear the screensfRenderWindow_clear(window, sfColor_fromRGBA(0,0,0,1))
# draw the spritesfRenderWindow_drawSprite(window, sprite, C_NULL)
# draw the textsfRenderWindow_drawText(window, text, C_NULL)
# update the windowsfRenderWindow_display(window)
endsfMusic_destroy(music)
sfText_destroy(text)
sfFont_destroy(font)
sfSprite_destroy(sprite)
sfTexture_destroy(texture)
sfRenderWindow_destroy(window)