graphics/ primitives.bi | |
License | Copyright © 2009, FreeBASIC Extended Library Development Group |
Functions | |
Triangle | Draws a flat shaded triangle. |
Triangle | Draws a flat shaded triangle. |
Examples | |
Drawing a Triangle | |
Using the Vector2D class to simplify Triangle drawing |
Copyright © 2009, FreeBASIC Extended Library Development Group
Distributed under the FreeBASIC Extended Library Group license. See accompanying file LICENSE.txt or copy at http://code.google.com- /p- /fb-extended-lib- /wiki- /License
declare sub Triangle overload ( byval dst as FB. IMAGE ptr = 0, byval x1 as integer, byval y1 as integer, byval x2 as integer, byval y2 as integer, byval x3 as integer, byval y3 as integer, byval col as uinteger = rgba(255,255,255,255) )
Draws a flat shaded triangle.
dst | FBGFX buffer to draw on. Pass 0 to draw to the screen. |
x1 | x coordinate of first point of triangle. |
y1 | y coordinate of first point of triangle. |
x2 | x coordinate of second point of triangle. |
y2 | y coordinate of second point of triangle. |
x3 | x coordinate of third point of triangle. |
y3 | y coordinate of third point of triangle. |
col | the color of the triangle to be drawn, defaults to &hffffff (white). |
declare sub Triangle( byval dst as FB. IMAGE ptr = 0, byref p1 as ext.math.vector2d, byref p2 as ext.math.vector2d, byref p3 as ext.math.vector2d, byval col as uinteger = rgba(255,255,255,255) )
Draws a flat shaded triangle.
dst | FBGFX buffer to draw on. Pass 0 to draw to the screen. |
p1 | vector2d containing the x and y of the first point. |
p2 | vector2d containing the x and y of the second point. |
p3 | vector2d containing the x and y of the third point. |
col | the color of the triangle to be drawn, defaults to &hffffff (white). |
#include once "ext/graphics.bi" #include once "fbgfx.bi" screenres 320, 240, 32 do while not multikey(FB.SC_ESCAPE) screenlock cls ext.gfx.Triangle( , 1, 1, 1, 10, 10, 1, rgb(255,0,0) ) 'Draw a red triangle in the top left corner of the screen screenunlock sleep 5 loop 'loop until the user pushes the ESC key
#include once "ext/graphics.bi" #include once "fbgfx.bi" screenres 320, 240, 32 dim as ext.math.Vector2D ptr Points Points = new ext.math.Vector2D[3] do while not multikey(FB.SC_ESCAPE) for n as uinteger = 0 to 2 Points[n].x = ext.math.RndRange(1.0,319.0) Points[n].y = ext.math.RndRange(1.0,319.0) next screenlock cls ext.gfx.Triangle( 0, Points[0], Points[1], Points[2], ext.math.RndRange(&h222222, &hFFFFFF) ) screenunlock sleep 100,1 loop delete[] Points
Draws a flat shaded triangle.
declare sub Triangle overload ( byval dst as FB. IMAGE ptr = 0, byval x1 as integer, byval y1 as integer, byval x2 as integer, byval y2 as integer, byval x3 as integer, byval y3 as integer, byval col as uinteger = rgba(255,255,255,255) )