Module stdinc

stdinc.nim

Converters

converter toCint*(x: int): cint
converter toInt*(x: uint8): int

Templates

template ptrMath*(body: untyped)

Pointer arithmetic. Could be used for pixels manipulation.

Example:

var surface = sdl.convertSurfaceFormat(
  sourceSurface, sdl.PixelFormat_RGBA8888, 0)
discard sdl.lockSurface(surface)
var pixels = cast[ptr uint32](surface.pixels)
let pitch = surface.pitch div 4
for y in 0..surface.h-1:
  for x in 0..pitch-1:
    ptrMath:                                #################
      pixels[x + y * pitch] = uint32(x * y) # Using ptrMath #
                                            #################
sdl.unlockSurface(surface)
template fourCC*(a, b, c, d: expr): uint32
Define a four character code as a uint32.