Skip to content
rpg edited this page Mar 30, 2012 · 5 revisions

Drawing

cheetah.enableDepthTest

cheetah.enableDepthTest()

Enables depth test. Useless if you didn't pass 'd' option to cheetah.init. Equivalent to glEnable(GL_DEPTH_TEST);

See also


cheetah.disableDepthTest

cheetah.disableDepthTest()

Disables depth test. Useless if you didn't pass 'd' option to cheetah.init. Equivalent to glDisable(GL_DEPTH_TEST);

See also


cheetah.enableStencilTest

cheetah.enableStencilTest()

Enables stencil test. Useless if you didn't pass 'd' option to cheetah.init. Equivalent to glEnable(GL_STENCIL_TEST);

See also


cheetah.disableStencilTest

cheetah.disableStencilTest()

Disables stencil test. Useless if you didn't pass 'd' option to cheetah.init. Equivalent to glDisable(GL_STENCIL_TEST);

See also


cheetah.move

cheetah.move(translateX, translateY)

Move object relatively to the current matrix position.

Parameters

  • translateX
    x coordinate
  • translateY
    y coordinate

See also


cheetah.scale

cheetah.scale(scaleX, scaleY)

Scale object relatively to the current matrix size (initially, matrix has size 1x1 pixel).

Parameters

  • scaleX
    x scale
  • scaleY
    y scale

See also


cheetah.rotate

cheetah.rotate(angle)

Rotate object relatively to the current matrix angle.

Parameters

  • angle
    angle

See also


cheetah.translateObject

cheetah.translateObject(x, y, angle, width, height, origin_x, origin_y)

Move, rotate and scale object relatively to it's center (origin)

Parameters

  • x
    x coordinate
  • y
    y coordinate
  • angle
    angle
  • width
    x scale
  • height
    y scale
  • origin_x
    x offset (center)
  • origin_y
    y offset (center)

See also


cheetah.autoScale

cheetah.autoScale(autoScale)

Enable or disable autoscale. Autoscale allows you to draw stuff in the fixed coordinates, and engine automatically translates all coordinates if window changes his size. Is you want to control screen size yourself, disable this.

Parameters

  • autoScale
    enable or disable autoscale

cheetah.blend

cheetah.blend(blend)

Enable or disable blending. Drawing without blending usually faster, but textures with alpha-channel will be poor. Blending is enabled by defaults.

Parameters

  • blend
    enable or disable blending

See also


cheetah.enableBlend

cheetah.enableBlend()

Enable blending.

See also


cheetah.disableBlend

cheetah.disableBlend()

Disable blending.

See also


cheetah.push

cheetah.push()

Push the transformation matrix. Equivalent to glPushMatrix();

See also


cheetah.pop

cheetah.pop()

Pop the transformation matrix. Equivalent to glPopMatrix();

See also


cheetah.reset

cheetah.reset()

Reset the transformation matrix. Equivalent to glLoadIdentity();

See also


cheetah.line

cheetah.line(x1, y1, x2, y2)

Draw line.

Parameters

  • x1
    x start
  • y1
    y start
  • x2
    x end
  • y2
    y end

See also


cheetah.rectangle

cheetah.rectangle(filled)

Draw rectangle. Note, if you bind texture or shader, filled rectangle may be shaded or textured.

Parameters

  • filled
    is rectangle filled

See also


cheetah.rectanglexy

cheetah.rectanglexy(x, y, w, h, filled)

Draw rectangle of given size at a given position. Note, if you bind texture or shader, filled rectangle may be shaded or textured.

Parameters

  • x
    position of left top corner
  • y
    position of left top corner
  • w
    width of quad
  • h
    height of quad
  • filled
    is rectangle filled

See also


cheetah.circle

cheetah.circle(rad, segments, filled)

Draw circle.

Parameters

  • rad
    radius
  • segments
    segments (more is slower and better)
  • filled
    is circle filled

See also


cheetah.circlexy

cheetah.circlexy(x, y, rad, segments, filled)

Draw circle at a given position.

Parameters

  • x
    position of circle center
  • y
    position of circle center
  • rad
    radius
  • segments
    segments (more is slower and better)
  • filled
    is circle filled

See also


cheetah.point

cheetah.point()

Draw point.

See also


cheetah.pointxy

cheetah.pointxy(x, y)

Draw point at a given position.

Parameters

  • x
    position
  • y
    position

See also


cheetah.pointSize

cheetah.pointSize(size)

Sets the current point size. Not all platforms support point size correctly.

Parameters

  • size
    point size

See also


cheetah.getPointSize

cheetah.getPointSize()

Gets the current point size.

Return value

point size

See also


cheetah.lineWidth

cheetah.lineWidth(width)

Sets the line width. Not all platforms support line width correctly.

Parameters

  • width
    line size

See also


cheetah.getLineWidth

cheetah.getLineWidth()

Gets the line width.

Return value

line size

See also


cheetah.smooth

cheetah.smooth(smooth)

Enables or disables lines and points smoothing. Not all platforms support this.

Parameters

  • smooth
    enable or disable smoothing

See also


cheetah.color

cheetah.color(r, g, b, a)

Sets the color.

Parameters

  • r
    red (0 - 255)
  • g
    green (0 - 255)
  • b
    blue (0 - 255)
  • a
    alpha (0 - 255)

See also


cheetah.colorf

cheetah.colorf(r, g, b, a)

Sets the color, float.

Parameters

  • r
    red (0 - 1) float
  • g
    green (0 - 1) float
  • b
    blue (0 - 1) float
  • a
    alpha (0 - 1) float

See also


cheetah.clearColor

cheetah.clearColor(r, g, b, a)

Sets the color for clear screen.

Parameters

  • r
    red
  • g
    green
  • b
    blue
  • a
    alpha

See also


cheetah.blendMode

cheetah.blendMode(mode)

Sets the blending mode. Blending modes allow you to create some cool effects.

Parameters

  • mode
    One of possible blending modes. 0 is defaults. Use pre-defined blending modes:
  • cheetah.blendAlpha or 0 - defaults
  • cheetah.blendMultiplicative
  • cheetah.blendAdditive
  • cheetah.blendSubstractive
  • cheetah.blendScreen - as photoshop blend mode
  • cheetah.blendDetail - interesting effect, allows to use gray detail textures

cheetah.blendEquation

cheetah.blendEquation(mode)

Specify the equation used for both the RGB blend equation and the Alpha blend equation. Equivalent to glBlendEquation(mode);

Parameters

  • mode
    Specifies how source and destination colors are combined. It must be:
  • cheetah.GL_FUNC_ADD
  • cheetah.GL_FUNC_SUBTRACT
  • cheetah.GL_FUNC_REVERSE_SUBTRACT
  • cheetah.GL_MIN
  • cheetah.GL_MAX

cheetah.blendFunc

cheetah.blendFunc(sourcefactor, destinationfactor)

Specify pixel arithmetic. Equivalent to glBlendFunc(sourcefactor, destinationfactor);

Parameters

  • sourcefactor
    Specifies how the red, green, blue, and alpha source blending factors are computed. The following symbolic constants are accepted:
  • cheetah.GL_ZERO
  • cheetah.GL_ONE
  • cheetah.GL_DST_COLOR
  • cheetah.GL_ONE_MINUS_DST_COLOR
  • cheetah.GL_SRC_ALPHA
  • cheetah.GL_ONE_MINUS_SRC_ALPHA
  • cheetah.GL_DST_ALPHA
  • cheetah.GL_ONE_MINUS_DST_ALPHA
  • cheetah.GL_SRC_ALPHA_SATURATE
  • destinationfactor
    Specifies how the red, green, blue, and alpha destination blending factors are computed. Eight symbolic constants are accepted:
  • cheetah.GL_ZERO
  • cheetah.GL_ONE
  • cheetah.GL_SRC_COLOR
  • cheetah.GL_ONE_MINUS_SRC_COLOR
  • cheetah.GL_SRC_ALPHA
  • cheetah.GL_ONE_MINUS_SRC_ALPHA
  • cheetah.GL_DST_ALPHA
  • cheetah.GL_ONE_MINUS_DST_ALPHA

cheetah.clear

cheetah.clear()

Clear screen. Usually used in lQuery.addhook(cheetah.clear). Slow. Do not use it if you have in your game image background.

See also


cheetah.clearColorDepth

cheetah.clearColorDepth()

Clear screen and depth buffer. Usually used in lQuery.addhook(cheetah.clearColorDepth). Slow.

See also


cheetah.clearColorStencil

cheetah.clearColorStencil()

Clear screen and stencil buffer. Usually used in lQuery.addhook(cheetah.clearColorStencil). Slow.

See also


cheetah.clearDepth

cheetah.clearDepth()

Clear depth buffer. Usually used in lQuery.addhook(cheetah.clearDepth). Slow.

See also


cheetah.clearStencil

cheetah.clearStencil()

Clear stencil buffer. Usually used in lQuery.addhook(cheetah.clearStencil). Slow.

See also

Timer

cheetah.getTicks

cheetah.getTicks()

Gets the number of milliseconds past from the execution time. Equivalent to SDL_GetTicks();


cheetah.getTime

cheetah.getTime()

Gets the time in seconds past from the execution time.


cheetah.delay

cheetah.delay(ms)

Do nothing some time.

Parameters

  • ms
    delay in milliseconds (1/1000 s)

See also


cheetah.sleep

cheetah.sleep(sec)

Do nothing some time.

Parameters

  • sec
    delay in seconds

See also

Window

cheetah.init

cheetah.init(appName, width, height, bpp, attr)

Create window and initialize all OpenGL's stuff. You MUST call this before any graphics function, e.g. cheetah.newImage. You may call this function again to re-size window, change application title, toggle fullscreen. Other options are ignored.

Parameters

  • appName
    application's title shown in titlebar
  • width
    width of the window
  • height
    height of the window
  • bpp
    bits per pixel (8, 16, 32, usually 32)
  • attr
    string of options. Supported options:
  • f - fullscreen
  • r - allow to resize window
  • v - enable vertical sync (recommend)
  • d - enable depth buffer (usually 2D apps do not need this)
  • s - enable stencil buffer (usually 2D apps do not need this)

Return value

true if success


cheetah.isInit

cheetah.isInit()

Check, if screen exists. Useful if you have windowless version of y our application, e.g. server.

Return value

true if screen was initialized


cheetah.getWindowWidth

cheetah.getWindowWidth()

Get window's width

Return value

width of the window

See also


cheetah.getWindowHeight

cheetah.getWindowHeight()

Get window's height

Return value

height of the window

See also


cheetah.swapBuffers

cheetah.swapBuffers()

Swap buffers and present graphics


cheetah.caption

cheetah.caption(text)

Set window's title

Parameters

  • text
    text to replace the caption

See also


cheetah.getModes

cheetah.getModes()

Get list of possible screen modes. You need this if you want to run application in fullscreen mode.

Return value

array of pointers to SDL_Rect structure.


cheetah.showCursor

cheetah.showCursor()

Shows the cursor


cheetah.hideCursor

cheetah.hideCursor()

Hides the cursor

Framebuffer

cheetah.newFramebuffer

cheetah.newFramebuffer(width, height, options)

Create framebuffer object. Note, that not all video drivers support this. It's recommend to check returning value using cheetah.inPointer and check framebuffer support using cheetah.supported.FBO.

Parameters

  • width
    width
  • height
    height
  • options
    string of options. Supported options:
  • a - enable alpha channel
  • n - enable smooth interpolation
  • r - repeat as texture (not all faramebuffers need this)
  • 1 - create 8 bits (1 byte) per channel framebuffer (default)
  • 2 - create 16 bits (2 byte) per channel framebuffer (slow), not all systems support this
  • 4 - create 32 bits (4 byte) per channel framebuffer (very SLOW), use only if you know, that you doing, not all systems support this

Return value

Framebuffer object


cheetah.framebufferBind

cheetah.framebufferBind(ptr)

Bind framebuffer object. Means, that now all graphics will be rendered to this framebuffer.

Parameters

  • ptr
    Framebuffer object

cheetah.framebufferUnbind

cheetah.framebufferUnbind()

Unbind framebuffer object. Means, that now all graphics will be rendered to default screen. This function unbinds the current framebuffer object.


cheetah.framebufferDraw

cheetah.framebufferDraw(ptr)

Draw framebuffer. Same as draw Image.

Parameters

  • ptr
    Framebuffer object

See also


cheetah.framebufferDrawq

cheetah.framebufferDrawq(ptr, qx, qy, qw, qh)

Draw part of framebuffer with texture coordinates.

Parameters

  • ptr
    Framebuffer object
  • qx
    x offset of framebuffer's texture
  • qy
    y offset of framebuffer's texture
  • qw
    width of framebuffer's texture
  • qh
    height of framebuffer's texture

See also


cheetah.deleteFramebuffer

cheetah.deleteFramebuffer(ptr)

Delete framebuffer and free memory.

Parameters

  • ptr
    Framebuffer object

Image

cheetah.newImage

cheetah.newImage(name)

Load image from disc.

Parameters

  • name
    file name

Return value

Image object


cheetah.newImageOpt

cheetah.newImageOpt(name, options)

Load image from disc with specific options.

Parameters

  • name
    file name
  • options
    string of options. This is depends on image loading module you use. Supported options:
  • n - use nearest interpolation
  • m - generate mip-maps (automatically sets mip-map interpolation)

Return value

Image object


cheetah.imageBind

cheetah.imageBind(image)

Bind Image object. Equivalent to glBindTexture.

Parameters

  • image
    Image object

cheetah.enableTexture2D

cheetah.enableTexture2D()

Enable texturing. Equivalent to glEnable(GL_TEXTURE_2D).


cheetah.disableTexture2D

cheetah.disableTexture2D()

Disable texturing. Equivalent to glDisable(GL_TEXTURE_2D).


cheetah.imageDraw

cheetah.imageDraw(image)

Draw while image using 1x1 pixel quad. You may change quad size and position using transformations.

Parameters

  • image
    Image object

cheetah.imageDrawq

cheetah.imageDrawq(image, qx, qy, qw, qh)

Draw part of image using 1x1 pixel quad with texture coordinates. You may change quad size and position using transformations.

Parameters

  • image
    Image object
  • qx
    x offset of texture
  • qy
    y offset of texture
  • qw
    width of texture
  • qh
    height of texture

cheetah.imageDrawqxy

cheetah.imageDrawqxy(image, x, y, w, h, qx, qy, qw, qh)

Draw part of image of given size at a given position using 1x1 pixel quad with texture coordinates. You may change quad size and position using transformations.

Parameters

  • image
    Image object
  • x
    position of left top corner
  • y
    position of left top corner
  • w
    width of quad
  • h
    height of quad
  • qx
    x offset of texture
  • qy
    y offset of texture
  • qw
    width of texture
  • qh
    height of texture

cheetah.activeTexture

cheetah.activeTexture(i)

Set the current active texture for multitexturenig. Equivalent to glActiveTexture(GL_TEXTURE0 + i).

Parameters

  • i
    number of texture slot (min 0, max 7)

cheetah.deleteImage

cheetah.deleteImage(ptr)

Delete image and free memory.

Parameters

  • ptr
    Image object

cheetah.imageFiltering

cheetah.imageFiltering(img, enabled)

Enable/disable smooth interpolation for image. Disabled filtering useful, if you want to fit image to pixel matrix. If this image will be scaled and/or rotated you must enable filtering (this is by defaults).

Parameters

  • img
    Image object
  • enabled
    true means that filtering is enabled, false means that filtering is disabled
Clone this wiki locally