Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
L3 - Projet programmation 2
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
v-lafeychine
L3 - Projet programmation 2
Commits
f4826b9f
Verified
Commit
f4826b9f
authored
3 years ago
by
v-lafeychine
Browse files
Options
Downloads
Patches
Plain Diff
Add example binding
parent
76fef0e7
No related branches found
Branches containing commit
No related tags found
1 merge request
!4
Resolve "Found graphics module"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/GraphicsSFML.scala
+79
-0
79 additions, 0 deletions
src/main/scala/GraphicsSFML.scala
with
79 additions
and
0 deletions
src/main/scala/GraphicsSFML.scala
0 → 100644
+
79
−
0
View file @
f4826b9f
import
scalanative.unsafe.
*
import
scalanative.unsigned.
*
object
SFMLSystem
{
type
sfBool
=
CInt
type
sfInt8
=
CChar
type
sfUint8
=
CUnsignedChar
type
sfInt16
=
CShort
type
sfUint16
=
CUnsignedShort
type
sfInt32
=
CInt
type
sfUint32
=
CUnsignedInt
type
sfInt64
=
CLongLong
type
sfUint64
=
CUnsignedLongLong
val
sfFalse
:
sfBool
=
0
val
sfTrue
:
sfBool
=
1
}
@link
(
"csfml-graphics"
)
@link
(
"csfml-window"
)
@extern
object
SFML
{
import
SFMLSystem.
*
type
sfVideoMode
=
CStruct3
[
CUnsignedInt
,
CUnsignedInt
,
CUnsignedInt
]
type
sfColor
=
CStruct4
[
sfUint8
,
sfUint8
,
sfUint8
,
sfUint8
]
type
sfRenderWindow
type
sfContextSettings
def
sfRenderWindow_create
(
mode
:
Ptr
[
sfVideoMode
],
title
:
CString
,
style
:
sfUint32
,
settings
:
Ptr
[
sfContextSettings
]
)
:
Ptr
[
sfRenderWindow
]
=
extern
def
sfRenderWindow_clear
(
renderWindow
:
Ptr
[
sfRenderWindow
],
color
:
Ptr
[
sfColor
]
)
:
Unit
=
extern
def
sfRenderWindow_destroy
(
renderWindow
:
Ptr
[
sfRenderWindow
]
)
:
Unit
=
extern
def
sfRenderWindow_display
(
renderWindow
:
Ptr
[
sfRenderWindow
]
)
:
Unit
=
extern
def
sfRenderWindow_isOpen
(
sfRenderWindow
:
Ptr
[
sfRenderWindow
]
)
:
sfBool
=
extern
}
import
SFML.
*
object
HelloWorld
extends
App
{
val
videomode
=
stackalloc
[
sfVideoMode
]()
videomode
.
_1
=
1080.
toUInt
videomode
.
_2
=
720.
toUInt
videomode
.
_3
=
32.
toUInt
val
sfBlack
=
stackalloc
[
sfColor
]()
sfBlack
.
_1
=
0.
toUByte
sfBlack
.
_2
=
0.
toUByte
sfBlack
.
_3
=
0.
toUByte
sfBlack
.
_4
=
0.
toUByte
var
window
=
sfRenderWindow_create
(
videomode
,
c
"Hello World"
,
0.
toUInt
,
null
)
while
true
do
{
sfRenderWindow_clear
(
window
,
sfBlack
)
sfRenderWindow_display
(
window
)
}
sfRenderWindow_destroy
(
window
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment