Skip to content

Commit 089da93

Browse files
author
Robot
committed
Generate sources (1024f20)
1 parent 07c2377 commit 089da93

File tree

11 files changed

+52
-42
lines changed

11 files changed

+52
-42
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ crystal snakes.cr
140140

141141
#### Make CrSFML available to your project
142142

143-
Create a symbolic link to *CrSFML* in your project's *libs* folder.
143+
Create a symbolic link to *CrSFML* in your project's *lib* folder.
144144

145145
```bash
146146
cd ~/my-project
147-
mkdir libs
148-
ln -s /full/path/to/crsfml/src libs/crsfml
147+
mkdir lib
148+
ln -s /full/path/to/crsfml/src lib/crsfml
149149

150150
# Try importing it:
151151
echo 'require "crsfml"' >> my_project.cr
File renamed without changes.

shard.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: crsfml
2-
version: 2.4.2
2+
version: 2.4.3
33

44
authors:
55
- Oleh Prypin <[email protected]>
@@ -8,3 +8,8 @@ description: |
88
Crystal bindings to SFML multimedia/game library
99
1010
license: zlib
11+
12+
crystal: 0.20.1
13+
14+
libraries:
15+
SFML: 2.4.1

src/audio/obj.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ module SF
194194
# Sound is playing
195195
Playing
196196
end
197-
_sf_enum SoundSource::Status
197+
Util.extract SoundSource::Status
198198
# Destructor
199199
def finalize()
200200
VoidCSFML.soundsource_finalize(to_unsafe)

src/common.cr

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
require "./sizes"
22

33
module SF
4-
VERSION = "2.4.2"
5-
SFML_VERSION = "2.4.0"
4+
VERSION = "2.4.3"
5+
SFML_VERSION = "2.4.1"
66

77
# Raised in shorthand class methods if initialization or resource loading fails
88
class InitError < Exception
99
end
10+
11+
private module Util
12+
# Copy all constants from the namespace into the current namespace
13+
macro extract(from)
14+
{% for c in from.resolve.constants %}
15+
# :nodoc:
16+
{{c}} = {{from}}::{{c}}{% if c.id.ends_with? "Count" %}.value{% end %}
17+
{% end %}
18+
end
19+
end
1020
end
1121

1222
# :nodoc:
13-
macro _sf_enum(from)
14-
{% for c in from.resolve.constants %}
15-
# :nodoc:
16-
{{c}} = {{from}}::{{c}}{% if c.id.ends_with? "Count" %}.value{% end %}
17-
{% end %}
18-
end

src/graphics/graphics.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ module SF
191191
# Forwards calls like `shader.param(arg1, arg2)` to
192192
# `shader.set_parameter("param", arg1, arg2)`
193193
macro method_missing(call)
194-
set_parameter {{call.name.stringify}}, {{call.args.argify}}
194+
set_parameter {{call.name.stringify}}, {{call.args.splat}}
195195
end
196196
end
197197

@@ -281,5 +281,5 @@ module SF
281281
# Overwrite dest with source
282282
BlendNone = BlendMode.new(BlendMode::One, BlendMode::Zero)
283283
end
284-
_sf_enum BlendMode
284+
Util.extract BlendMode
285285
end

src/graphics/obj.cr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module SF
8181
# (1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a)
8282
OneMinusDstAlpha
8383
end
84-
_sf_enum BlendMode::Factor
84+
Util.extract BlendMode::Factor
8585
# Enumeration of the blending equations
8686
#
8787
# The equations are mapped directly to their OpenGL equivalents,
@@ -94,7 +94,7 @@ module SF
9494
# Pixel = Dst * DstFactor - Src * SrcFactor
9595
ReverseSubtract
9696
end
97-
_sf_enum BlendMode::Equation
97+
Util.extract BlendMode::Equation
9898
# Default constructor
9999
#
100100
# Constructs a blending mode that does alpha blending.
@@ -1542,7 +1542,7 @@ module SF
15421542
# *Deprecated:* Use TriangleFan instead
15431543
TrianglesFan = TriangleFan
15441544
end
1545-
_sf_enum PrimitiveType
1545+
Util.extract PrimitiveType
15461546
# Define a set of one or more 2D primitives
15471547
#
15481548
# `SF::VertexArray` is a very simple wrapper around a dynamic
@@ -3050,7 +3050,7 @@ module SF
30503050
# Texture coordinates in range `0.0 .. size`
30513051
Pixels
30523052
end
3053-
_sf_enum Texture::CoordinateType
3053+
Util.extract Texture::CoordinateType
30543054
# Default constructor
30553055
#
30563056
# Creates an empty texture.
@@ -5489,7 +5489,7 @@ module SF
54895489
# Fragment (pixel) shader
54905490
Fragment
54915491
end
5492-
_sf_enum Shader::Type
5492+
Util.extract Shader::Type
54935493
# Default constructor
54945494
#
54955495
# This constructor creates an invalid shader.
@@ -6262,7 +6262,7 @@ module SF
62626262
# Strike through characters
62636263
StrikeThrough = 1 << 3
62646264
end
6265-
_sf_enum Text::Style
6265+
Util.extract Text::Style
62666266
# Default constructor
62676267
#
62686268
# Creates an empty text.

src/network/obj.cr

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module SF
4747
# An unexpected error happened
4848
Error
4949
end
50-
_sf_enum Socket::Status
50+
Util.extract Socket::Status
5151
# Special value that tells the system to pick any available port
5252
AnyPort = 0
5353
# Destructor
@@ -87,7 +87,7 @@ module SF
8787
# UDP protocol
8888
Udp
8989
end
90-
_sf_enum Socket::Type
90+
Util.extract Socket::Type
9191
# Default constructor
9292
#
9393
# This constructor can only be accessed by derived classes.
@@ -436,7 +436,7 @@ module SF
436436
# Text mode using EBCDIC encoding
437437
Ebcdic
438438
end
439-
_sf_enum Ftp::TransferMode
439+
Util.extract Ftp::TransferMode
440440
# Define a FTP response
441441
class Response
442442
@_ftp_response : VoidCSFML::Ftp_Response_Buffer
@@ -529,7 +529,7 @@ module SF
529529
# Not part of the FTP standard, generated by SFML when a local file cannot be read or written
530530
InvalidFile = 1003
531531
end
532-
_sf_enum Ftp::Response::Status
532+
Util.extract Ftp::Response::Status
533533
# Default constructor
534534
#
535535
# This constructor is used by the FTP client to build
@@ -1257,7 +1257,7 @@ module SF
12571257
# Request in delete mode, useful for a REST API
12581258
Delete
12591259
end
1260-
_sf_enum Http::Request::Method
1260+
Util.extract Http::Request::Method
12611261
# Default constructor
12621262
#
12631263
# This constructor creates a GET request, with the root
@@ -1392,7 +1392,7 @@ module SF
13921392
# Connection with server failed
13931393
ConnectionFailed = 1001
13941394
end
1395-
_sf_enum Http::Response::Status
1395+
Util.extract Http::Response::Status
13961396
# Default constructor
13971397
#
13981398
# Constructs an empty response.
@@ -2239,9 +2239,11 @@ module SF
22392239
end
22402240
# Unbind the socket from the local port to which it is bound
22412241
#
2242-
# The port that the socket was previously using is immediately
2243-
# available after this function is called. If the
2244-
# socket is not bound to a port, this function has no effect.
2242+
# The port that the socket was previously bound to is immediately
2243+
# made available to the operating system after this function is called.
2244+
# This means that a subsequent call to bind() will be able to re-bind
2245+
# the port if no other process has done so in the mean time.
2246+
# If the socket is not bound to a port, this function has no effect.
22452247
#
22462248
# *See also:* `bind`
22472249
def unbind()

src/sizes.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ lib VoidCSFML
1919
alias MemoryInputStream_Buffer = UInt8[24]
2020
alias Thread_Buffer = UInt8[16]
2121
alias ThreadLocal_Buffer = UInt8[8]
22+
alias Context_Buffer = UInt8[8]
2223
alias GlResource_Buffer = UInt8[1]
2324
alias ContextSettings_Buffer = UInt8[28]
24-
alias Context_Buffer = UInt8[8]
2525
alias Joystick_Buffer = UInt8[1]
2626
alias Joystick_Identification_Buffer = UInt8[40]
2727
alias Keyboard_Buffer = UInt8[1]

src/window/obj.cr

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module SF
7979
# Debug attribute
8080
Debug = 1 << 2
8181
end
82-
_sf_enum ContextSettings::Attribute
82+
Util.extract ContextSettings::Attribute
8383
# Default constructor
8484
#
8585
# * *depth* - Depth buffer bits
@@ -359,7 +359,7 @@ module SF
359359
# The Y axis of the point-of-view hat
360360
PovY
361361
end
362-
_sf_enum Joystick::Axis
362+
Util.extract Joystick::Axis
363363
# Structure holding a joystick's identification
364364
class Identification
365365
@_joystick_identification : VoidCSFML::Joystick_Identification_Buffer
@@ -723,7 +723,7 @@ module SF
723723
# Keep last -- the total number of keyboard keys
724724
KeyCount
725725
end
726-
_sf_enum Keyboard::Key
726+
Util.extract Keyboard::Key
727727
# Check if a key is pressed
728728
#
729729
# * *key* - Key to check
@@ -800,15 +800,15 @@ module SF
800800
# Keep last -- the total number of mouse buttons
801801
ButtonCount
802802
end
803-
_sf_enum Mouse::Button
803+
Util.extract Mouse::Button
804804
# Mouse wheels
805805
enum Wheel
806806
# The vertical mouse wheel
807807
VerticalWheel
808808
# The horizontal mouse wheel
809809
HorizontalWheel
810810
end
811-
_sf_enum Mouse::Wheel
811+
Util.extract Mouse::Wheel
812812
# Check if a mouse button is pressed
813813
#
814814
# * *button* - Button to check
@@ -924,7 +924,7 @@ module SF
924924
# Keep last -- the total number of sensor types
925925
Count
926926
end
927-
_sf_enum Sensor::Type
927+
Util.extract Sensor::Type
928928
# Check if a sensor is available on the underlying platform
929929
#
930930
# * *sensor* - Sensor to check
@@ -2299,9 +2299,7 @@ module SF
22992299
# If set, grabs the mouse cursor inside this window's client
23002300
# area so it may no longer be moved outside its bounds.
23012301
# Note that grabbing is only active while the window has
2302-
# focus and calling this function for fullscreen windows
2303-
# won't have any effect (fullscreen windows always grab the
2304-
# cursor).
2302+
# focus.
23052303
#
23062304
# * *grabbed* - True to enable, false to disable
23072305
def mouse_cursor_grabbed=(grabbed : Bool)

0 commit comments

Comments
 (0)