Add tests for examples from Nim in Action.
This commit is contained in:
parent
a585748f27
commit
7889c03cbc
34 changed files with 1213 additions and 0 deletions
26
tests/niminaction/Chapter8/sfml/sfml.nim
Normal file
26
tests/niminaction/Chapter8/sfml/sfml.nim
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{.passL: "-lsfml-graphics -lsfml-system -lsfml-window".}
|
||||
|
||||
type
|
||||
VideoMode* {.importcpp: "sf::VideoMode".} = object
|
||||
RenderWindowObj {.importcpp: "sf::RenderWindow".} = object
|
||||
RenderWindow* = ptr RenderWindowObj
|
||||
Color* {.importcpp: "sf::Color".} = object
|
||||
Event* {.importcpp: "sf::Event".} = object
|
||||
|
||||
{.push cdecl, header: "<SFML/Graphics.hpp>".}
|
||||
|
||||
proc videoMode*(modeWidth, modeHeight: cuint, modeBitsPerPixel: cuint = 32): VideoMode
|
||||
{.importcpp: "sf::VideoMode(@)", constructor.}
|
||||
|
||||
proc newRenderWindow*(mode: VideoMode, title: cstring): RenderWindow
|
||||
{.importcpp: "new sf::RenderWindow(@)", constructor.}
|
||||
|
||||
proc pollEvent*(window: RenderWindow, event: var Event): bool
|
||||
{.importcpp: "#.pollEvent(@)".}
|
||||
|
||||
proc newColor*(red, green, blue, alpha: uint8): Color
|
||||
{.importcpp: "sf::Color(@)", constructor.}
|
||||
|
||||
proc clear*(window: RenderWindow, color: Color) {.importcpp: "#.clear(@)".}
|
||||
|
||||
proc display*(window: RenderWindow) {.importcpp: "#.display()".}
|
||||
Loading…
Add table
Add a link
Reference in a new issue