Skip to content

Commit

Permalink
Fix for 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed May 21, 2015
1 parent 34a63f6 commit 26e175f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions examples/shapes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ while window.open:
vertex(vec2(100, 0), Red),
vertex(vec2(200, 100), Blue),
]
window.drawPrimitives(addr(vertexSeq[0]), cint(vertexSeq.len),
window.drawPrimitives(addr(vertexSeq[0]), vertexSeq.len,
PrimitiveType.Triangles, renderStates())

# Bottom left
Expand All @@ -40,8 +40,8 @@ while window.open:
window.draw convexShape

# Bottom right
proc getPointCount(p: pointer): cint {.cdecl.} = 3
proc getPoint(index: cint, p: pointer): Vector2f {.cdecl.} =
proc getPointCount(p: pointer): int {.cdecl.} = 3
proc getPoint(index: int, p: pointer): Vector2f {.cdecl.} =
case index
of 0: vec2(200, 200)
of 1: vec2(100, 200)
Expand Down
5 changes: 1 addition & 4 deletions src/csfml_graphics.nim
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ proc `*`*(a, b: Color): Color =
modulate(a, b)
proc `-`*(a, b: Color): Color =
## *Returns:* The component-wise subtraction of two colors. Components below 0 are clamped to 0.
if a.r > b.r: result.r = a.r-b.r
if a.g > b.g: result.g = a.g-b.g
if a.b > b.b: result.b = a.b-b.b
if a.a > b.a: result.a = a.a-b.a
subtract(a, b)

let
Black* = color(0, 0, 0)
Expand Down
7 changes: 6 additions & 1 deletion src/csfml_window.nim
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,25 @@ include private/csfml_window_gen
{.pop.}


proc contextSettings*(depth: cint = 0, stencil: cint = 0, antialiasing: cint = 0, major: cint = 2, minor: cint = 0): ContextSettings =
converter toBitMaskU32*(a: ContextAttribute): BitMaskU32 = BitMaskU32 a
## Allows ContextAttribute values to be combined using the | operator and be used in functions

proc contextSettings*(depth: cint = 0, stencil: cint = 0, antialiasing: cint = 0, major: cint = 2, minor: cint = 0, attributes = ContextAttribute.Default): ContextSettings =
## *Arguments*:
## ``depth``: Depth buffer bits
## ``stencil``: Stencil buffer bits
## ``antialiasing``: Antialiasing level
## ``major``: Major number of the context version
## ``minor``: Minor number of the context version
## ``attributes``: The attribute flags to create the context with
##
## *Returns*: ContextSettings with these members
result.depthBits = depth
result.stencilBits = stencil
result.antialiasingLevel = antialiasing
result.majorVersion = major
result.minorVersion = minor
result.attributeFlags = attributes


proc mouse_getPosition*(): Vector2i = mouse_getPosition(nil)
Expand Down
4 changes: 3 additions & 1 deletion src/private/csfml_union_event.nim
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ type
mouseMove*: MouseMoveEvent
of EventType.MouseWheelMoved:
mouseWheel*: MouseWheelEvent
else: nil
of EventType.MouseWheelScrolled:
mouseWheelScroll*: MouseWheelScrollEvent
else: nil

0 comments on commit 26e175f

Please sign in to comment.