Skip to content

Commit df8bf62

Browse files
committed
Change to LibC::SizeT
1 parent 8299d4f commit df8bf62

File tree

12 files changed

+77
-79
lines changed

12 files changed

+77
-79
lines changed

generate/generate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def rename_type(name, var=''):
5656
name = {
5757
'char': 'UInt8',
5858
'int': 'Int32',
59-
'size_t': 'SizeT',
59+
'size_t': 'LibC::SizeT',
6060
'sfBool': 'CSFML::Bool',
6161
'unsigned int': 'Int32',
6262
'unsigned short': 'UInt16',
@@ -358,9 +358,9 @@ def handle_function(main, params):
358358
elif (' '+params[i][0]).endswith(' int'):
359359
t = 'Int'
360360
conv.append('{0} = {0}.to_i32'.format(n))
361-
elif t == 'SizeT':
361+
elif t == 'LibC::SizeT':
362362
t = 'Int'
363-
conv.append('{0} = CSFML::SizeT.cast({0})'.format(n))
363+
conv.append('{0} = LibC::SizeT.cast({0})'.format(n))
364364
elif t == 'UInt64':
365365
t = 'Int'
366366
conv.append('{0} = {0}.to_u64'.format(n))

src/audio_lib.cr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ lib CSFML
118118
# * `size_in_bytes`: Size of the data to load, in bytes
119119
#
120120
# *Returns*: A new Music object (NULL if failed)
121-
fun music_create_from_memory = sfMusic_createFromMemory(data: Void*, size_in_bytes: SizeT): Music
121+
fun music_create_from_memory = sfMusic_createFromMemory(data: Void*, size_in_bytes: LibC::SizeT): Music
122122

123123
# Create a new music and load it from a custom stream
124124
#
@@ -687,7 +687,7 @@ lib CSFML
687687
# * `size_in_bytes`: Size of the data to load, in bytes
688688
#
689689
# *Returns*: A new SoundBuffer object (NULL if failed)
690-
fun sound_buffer_create_from_memory = sfSoundBuffer_createFromMemory(data: Void*, size_in_bytes: SizeT): SoundBuffer
690+
fun sound_buffer_create_from_memory = sfSoundBuffer_createFromMemory(data: Void*, size_in_bytes: LibC::SizeT): SoundBuffer
691691

692692
# Create a new sound buffer and load it from a custom stream
693693
#
@@ -868,7 +868,7 @@ lib CSFML
868868
fun sound_buffer_recorder_get_buffer = sfSoundBufferRecorder_getBuffer(sound_buffer_recorder: SoundBufferRecorder): SoundBuffer
869869

870870
alias SoundRecorderStartCallback = (Void*) -> CSFML::Bool
871-
alias SoundRecorderProcessCallback = (Int16*, SizeT, Void*) -> CSFML::Bool
871+
alias SoundRecorderProcessCallback = (Int16*, LibC::SizeT, Void*) -> CSFML::Bool
872872
alias SoundRecorderStopCallback = (Void*) -> Void
873873
# Construct a new sound recorder from callback functions
874874
#
@@ -964,7 +964,7 @@ lib CSFML
964964
# * `count`: Pointer to a variable that will be filled with the number of modes in the array
965965
#
966966
# *Returns*: An array of strings containing the names
967-
fun sound_recorder_get_available_devices = sfSoundRecorder_getAvailableDevices(count: SizeT*): UInt8**
967+
fun sound_recorder_get_available_devices = sfSoundRecorder_getAvailableDevices(count: LibC::SizeT*): UInt8**
968968

969969
# Get the name of the default audio capture device
970970
#

src/audio_obj.cr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ module SF
140140
#
141141
# *Returns*: A new Music object (NULL if failed)
142142
def self.from_memory(data: Void*, size_in_bytes: Int)
143-
size_in_bytes = CSFML::SizeT.cast(size_in_bytes)
143+
size_in_bytes = LibC::SizeT.cast(size_in_bytes)
144144
Music.transfer_ptr(CSFML.music_create_from_memory(data, size_in_bytes))
145145
end
146146

@@ -837,7 +837,7 @@ module SF
837837
#
838838
# *Returns*: A new SoundBuffer object (NULL if failed)
839839
def self.from_memory(data: Void*, size_in_bytes: Int)
840-
size_in_bytes = CSFML::SizeT.cast(size_in_bytes)
840+
size_in_bytes = LibC::SizeT.cast(size_in_bytes)
841841
SoundBuffer.transfer_ptr(CSFML.sound_buffer_create_from_memory(data, size_in_bytes))
842842
end
843843

@@ -1179,7 +1179,7 @@ module SF
11791179
# * `count`: Pointer to a variable that will be filled with the number of modes in the array
11801180
#
11811181
# *Returns*: An array of strings containing the names
1182-
def self.get_available_devices(count: SizeT*)
1182+
def self.get_available_devices(count: LibC::SizeT*)
11831183
CSFML.sound_recorder_get_available_devices(count)
11841184
end
11851185

src/common_lib.cr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121

2222
lib CSFML
23-
alias SizeT = LibC::SizeT
24-
2523
alias Bool = Int32
2624

2725
ifdef windows || macosx

src/graphics.cr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ module SF
173173
def initialize()
174174
@owned = true
175175
@funcs = Box.box({
176-
-> { CSFML::SizeT.cast(point_count) },
177-
->(i: CSFML::SizeT) { SF.vector2f(get_point(i)) }
176+
-> { LibC::SizeT.cast(point_count) },
177+
->(i: LibC::SizeT) { SF.vector2f(get_point(i)) }
178178
})
179179
@this = CSFML.shape_create(
180-
->(data) { Box({(-> CSFML::SizeT), (CSFML::SizeT -> SF::Vector2f)}).unbox(data)[0].call },
181-
->(i, data) { Box({(-> CSFML::SizeT), (CSFML::SizeT -> SF::Vector2f)}).unbox(data)[1].call(i) },
180+
->(data) { Box({(-> LibC::SizeT), (LibC::SizeT -> SF::Vector2f)}).unbox(data)[0].call },
181+
->(i, data) { Box({(-> LibC::SizeT), (LibC::SizeT -> SF::Vector2f)}).unbox(data)[1].call(i) },
182182
@funcs
183183
)
184184
update
@@ -345,7 +345,7 @@ module SF
345345
else
346346
pstates = nil
347347
end
348-
CSFML.render_texture_draw_primitives(@this, vertices, CSFML::SizeT.cast(vertices.length), type, pstates)
348+
CSFML.render_texture_draw_primitives(@this, vertices, LibC::SizeT.cast(vertices.length), type, pstates)
349349
end
350350
end
351351

@@ -363,7 +363,7 @@ module SF
363363
else
364364
pstates = nil
365365
end
366-
CSFML.render_window_draw_primitives(@this, vertices, CSFML::SizeT.cast(vertices.length), type, pstates)
366+
CSFML.render_window_draw_primitives(@this, vertices, LibC::SizeT.cast(vertices.length), type, pstates)
367367
end
368368

369369
def poll_event()

src/graphics_lib.cr

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ lib CSFML
599599
# * `shape`: Shape object
600600
#
601601
# *Returns*: Number of points of the shape
602-
fun circle_shape_get_point_count = sfCircleShape_getPointCount(shape: CircleShape): SizeT
602+
fun circle_shape_get_point_count = sfCircleShape_getPointCount(shape: CircleShape): LibC::SizeT
603603

604604
# Get a point of a circle shape
605605
#
@@ -611,7 +611,7 @@ lib CSFML
611611
# * `index`: Index of the point to get, in range [0 .. get_point_count() - 1]
612612
#
613613
# *Returns*: Index-th point of the shape
614-
fun circle_shape_get_point = sfCircleShape_getPoint(shape: CircleShape, index: SizeT): Vector2f
614+
fun circle_shape_get_point = sfCircleShape_getPoint(shape: CircleShape, index: LibC::SizeT): Vector2f
615615

616616
# Set the radius of a circle
617617
#
@@ -636,7 +636,7 @@ lib CSFML
636636
#
637637
# * `shape`: Shape object
638638
# * `count`: New number of points of the circle
639-
fun circle_shape_set_point_count = sfCircleShape_setPointCount(shape: CircleShape, count: SizeT)
639+
fun circle_shape_set_point_count = sfCircleShape_setPointCount(shape: CircleShape, count: LibC::SizeT)
640640

641641
# Get the local bounding rectangle of a circle shape
642642
#
@@ -955,7 +955,7 @@ lib CSFML
955955
# * `shape`: Shape object
956956
#
957957
# *Returns*: Number of points of the shape
958-
fun convex_shape_get_point_count = sfConvexShape_getPointCount(shape: ConvexShape): SizeT
958+
fun convex_shape_get_point_count = sfConvexShape_getPointCount(shape: ConvexShape): LibC::SizeT
959959

960960
# Get a point of a convex shape
961961
#
@@ -967,7 +967,7 @@ lib CSFML
967967
# * `index`: Index of the point to get, in range [0 .. get_point_count() - 1]
968968
#
969969
# *Returns*: Index-th point of the shape
970-
fun convex_shape_get_point = sfConvexShape_getPoint(shape: ConvexShape, index: SizeT): Vector2f
970+
fun convex_shape_get_point = sfConvexShape_getPoint(shape: ConvexShape, index: LibC::SizeT): Vector2f
971971

972972
# Set the number of points of a convex shap
973973
#
@@ -977,7 +977,7 @@ lib CSFML
977977
#
978978
# * `shape`: Shape object
979979
# * `count`: New number of points of the shape
980-
fun convex_shape_set_point_count = sfConvexShape_setPointCount(shape: ConvexShape, count: SizeT)
980+
fun convex_shape_set_point_count = sfConvexShape_setPointCount(shape: ConvexShape, count: LibC::SizeT)
981981

982982
# Set the position of a point in a convex shape
983983
#
@@ -992,7 +992,7 @@ lib CSFML
992992
# * `shape`: Shape object
993993
# * `index`: Index of the point to change, in range [0 .. GetPointCount() - 1]
994994
# * `point`: New point
995-
fun convex_shape_set_point = sfConvexShape_setPoint(shape: ConvexShape, index: SizeT, point: Vector2f)
995+
fun convex_shape_set_point = sfConvexShape_setPoint(shape: ConvexShape, index: LibC::SizeT, point: Vector2f)
996996

997997
# Get the local bounding rectangle of a convex shape
998998
#
@@ -1052,7 +1052,7 @@ lib CSFML
10521052
# * `size_in_bytes`: Size of the data to load, in bytes
10531053
#
10541054
# *Returns*: A new Font object, or NULL if it failed
1055-
fun font_create_from_memory = sfFont_createFromMemory(data: Void*, size_in_bytes: SizeT): Font
1055+
fun font_create_from_memory = sfFont_createFromMemory(data: Void*, size_in_bytes: LibC::SizeT): Font
10561056

10571057
# Create a new image font a custom stream
10581058
#
@@ -1227,7 +1227,7 @@ lib CSFML
12271227
# * `size`: Size of the data to load, in bytes
12281228
#
12291229
# *Returns*: A new Image object, or NULL if it failed
1230-
fun image_create_from_memory = sfImage_createFromMemory(data: Void*, size: SizeT): Image
1230+
fun image_create_from_memory = sfImage_createFromMemory(data: Void*, size: LibC::SizeT): Image
12311231

12321232
# Create an image from a custom stream
12331233
#
@@ -1673,7 +1673,7 @@ lib CSFML
16731673
# * `shape`: Shape object
16741674
#
16751675
# *Returns*: Number of points of the shape
1676-
fun rectangle_shape_get_point_count = sfRectangleShape_getPointCount(shape: RectangleShape): SizeT
1676+
fun rectangle_shape_get_point_count = sfRectangleShape_getPointCount(shape: RectangleShape): LibC::SizeT
16771677

16781678
# Get a point of a rectangle shape
16791679
#
@@ -1685,7 +1685,7 @@ lib CSFML
16851685
# * `index`: Index of the point to get, in range [0 .. get_point_count() - 1]
16861686
#
16871687
# *Returns*: Index-th point of the shape
1688-
fun rectangle_shape_get_point = sfRectangleShape_getPoint(shape: RectangleShape, index: SizeT): Vector2f
1688+
fun rectangle_shape_get_point = sfRectangleShape_getPoint(shape: RectangleShape, index: LibC::SizeT): Vector2f
16891689

16901690
# Set the size of a rectangle shape
16911691
#
@@ -1917,7 +1917,7 @@ lib CSFML
19171917
# * `vertex_count`: Number of vertices in the array
19181918
# * `type`: Type of primitives to draw
19191919
# * `states`: Render states to use for drawing (NULL to use the default states)
1920-
fun render_texture_draw_primitives = sfRenderTexture_drawPrimitives(render_texture: RenderTexture, vertices: Vertex*, vertex_count: SizeT, type: PrimitiveType, states: RenderStates*)
1920+
fun render_texture_draw_primitives = sfRenderTexture_drawPrimitives(render_texture: RenderTexture, vertices: Vertex*, vertex_count: LibC::SizeT, type: PrimitiveType, states: RenderStates*)
19211921

19221922
# Save the current OpenGL render states and matrices
19231923
#
@@ -2371,7 +2371,7 @@ lib CSFML
23712371
# * `vertex_count`: Number of vertices in the array
23722372
# * `type`: Type of primitives to draw
23732373
# * `states`: Render states to use for drawing (NULL to use the default states)
2374-
fun render_window_draw_primitives = sfRenderWindow_drawPrimitives(render_window: RenderWindow, vertices: Vertex*, vertex_count: SizeT, type: PrimitiveType, states: RenderStates*)
2374+
fun render_window_draw_primitives = sfRenderWindow_drawPrimitives(render_window: RenderWindow, vertices: Vertex*, vertex_count: LibC::SizeT, type: PrimitiveType, states: RenderStates*)
23752375

23762376
# Save the current OpenGL render states and matrices
23772377
#
@@ -2725,8 +2725,8 @@ lib CSFML
27252725
# *Returns*: True if the system can use shaders, False otherwise
27262726
fun shader_is_available = sfShader_isAvailable(): CSFML::Bool
27272727

2728-
alias ShapeGetPointCountCallback = (Void*) -> SizeT
2729-
alias ShapeGetPointCallback = (SizeT, Void*) -> Vector2f
2728+
alias ShapeGetPointCountCallback = (Void*) -> LibC::SizeT
2729+
alias ShapeGetPointCallback = (LibC::SizeT, Void*) -> Vector2f
27302730
# Create a new shape
27312731
#
27322732
# *Arguments*:
@@ -3011,7 +3011,7 @@ lib CSFML
30113011
# * `shape`: Shape object
30123012
#
30133013
# *Returns*: Number of points of the shape
3014-
fun shape_get_point_count = sfShape_getPointCount(shape: Shape): SizeT
3014+
fun shape_get_point_count = sfShape_getPointCount(shape: Shape): LibC::SizeT
30153015

30163016
# Get a point of a shape
30173017
#
@@ -3023,7 +3023,7 @@ lib CSFML
30233023
# * `index`: Index of the point to get, in range [0 .. get_point_count() - 1]
30243024
#
30253025
# *Returns*: Index-th point of the shape
3026-
fun shape_get_point = sfShape_getPoint(shape: Shape, index: SizeT): Vector2f
3026+
fun shape_get_point = sfShape_getPoint(shape: Shape, index: LibC::SizeT): Vector2f
30273027

30283028
# Get the local bounding rectangle of a shape
30293029
#
@@ -3632,7 +3632,7 @@ lib CSFML
36323632
# * `index`: Index of the character
36333633
#
36343634
# *Returns*: Position of the character
3635-
fun text_find_character_pos = sfText_findCharacterPos(text: Text, index: SizeT): Vector2f
3635+
fun text_find_character_pos = sfText_findCharacterPos(text: Text, index: LibC::SizeT): Vector2f
36363636

36373637
# Get the local bounding rectangle of a text
36383638
#
@@ -3693,7 +3693,7 @@ lib CSFML
36933693
# * `area`: Area of the source image to load (NULL to load the entire image)
36943694
#
36953695
# *Returns*: A new Texture object, or NULL if it failed
3696-
fun texture_create_from_memory = sfTexture_createFromMemory(data: Void*, size_in_bytes: SizeT, area: IntRect*): Texture
3696+
fun texture_create_from_memory = sfTexture_createFromMemory(data: Void*, size_in_bytes: LibC::SizeT, area: IntRect*): Texture
36973697

36983698
# Create a new texture from a custom stream
36993699
#
@@ -4058,7 +4058,7 @@ lib CSFML
40584058
# * `vertex_array`: Vertex array object
40594059
#
40604060
# *Returns*: Number of vertices in the array
4061-
fun vertex_array_get_vertex_count = sfVertexArray_getVertexCount(vertex_array: VertexArray): SizeT
4061+
fun vertex_array_get_vertex_count = sfVertexArray_getVertexCount(vertex_array: VertexArray): LibC::SizeT
40624062

40634063
# Get access to a vertex by its index
40644064
#
@@ -4072,7 +4072,7 @@ lib CSFML
40724072
# * `index`: Index of the vertex to get
40734073
#
40744074
# *Returns*: Pointer to the index-th vertex
4075-
fun vertex_array_get_vertex = sfVertexArray_getVertex(vertex_array: VertexArray, index: SizeT): Vertex*
4075+
fun vertex_array_get_vertex = sfVertexArray_getVertex(vertex_array: VertexArray, index: LibC::SizeT): Vertex*
40764076

40774077
# Clear a vertex array
40784078
#
@@ -4098,7 +4098,7 @@ lib CSFML
40984098
#
40994099
# * `vertex_array`: Vertex array objet
41004100
# * `vertex_count`: New size of the array (number of vertices)
4101-
fun vertex_array_resize = sfVertexArray_resize(vertex_array: VertexArray, vertex_count: SizeT)
4101+
fun vertex_array_resize = sfVertexArray_resize(vertex_array: VertexArray, vertex_count: LibC::SizeT)
41024102

41034103
# Add a vertex to a vertex array array
41044104
#

0 commit comments

Comments
 (0)