(AGK version: 108.13)
Submitted: 2013-06-17 12:56:19
do

    x#=getpointerx()
    y#=getpointery()

    DrawCrossLine(x#,y#,255,255,0)

    if getpointerpressed()=1 then exit

    sync()
loop
end

function DrawCrossLine(x#,y#,r,g,b)

    //draw a cross

    drawline(x#,0,x#,getvirtualheight(),r,g,b)
    drawline(0,y#,getvirtualwidth(),y#,r,g,b)

endfunction
(AGK version: 108.14)
Submitted: 2014-05-15 09:14:53
rem
rem AGK Application
rem

rem Landscape App

rem Draws 4 Humps without gaps in between DrawLine uses Virtual Coordinates!

SetDisplayAspect( 4.0/3.0 )
SetResolutionMode(1)

do
 Print("2D Terrain Test 4 Humps")
 VH# = GetVirtualHeight()
 vw# = GetVirtualWidth()
 dw# = GetDeviceWidth()
 ss# = vw# / dw#
 sfx# = 360.0 / vw#
 Print ("Virtual Width = " +Str(vw#))
 Print ("Device Width = " +Str(dw#))

 print("Step Size = " +Str(ss#))
 for x# = 0 to vw# step ss#
    LH# = Abs(Sin(2 * X# * sfx#)) * VH# * 0.66
    DrawLine (x#,VH#,x#,VH#-LH#,255,255,255)
 next x
 Sync()
loop
(AGK version: 2)
Submitted: 2014-11-13 13:23:23
//==============================================================================
//==============================  SNOWFLAKE-DEMO  ==============================
//============================== by Sigtrygg, 2014  ============================
//==============================================================================

sw=1024 //screen width
sh=768 //screen height

// set window properties
SetWindowTitle( "Snowflake" )
SetWindowSize( sw, sh, 0 )

// set display properties
SetVirtualResolution( sw, sh )


// Have fun to make experiments with changing parameters!!!

r=300 // Radius
x=sw/2 // start x, center of image
y=sh/2 // start y, center of image

//create image with size 1024x768 suitable for rendering
CreateRenderImage (1,sw,sh,0,0) 

Do

//set following drawcommands to the renderimage 1
SetRenderToImage (1,0) 

//draw one line with random colours
drawLine( x,y,x,y-r,Random(0,255),random(0,255),random(0,255)) 
t=random (0,100) //distance of first feather from center
distance=random(1,50) //distance between feathers


For u= t To 300 Step distance
	i=random (5,80) //Lenght of feather
	red=random (0,255) //value for red colour
	green=random (0,255) 
	blue=random (0,255)
	
	//make lines in angles of 60 degree
	drawLine (x,y-u,x+1.333*i,y-u-i,red, green, blue) 
	drawLine (x,y-u,x-1.333*i,y-u-i,red, green, blue)
Next u

//set following drawcommands to screen
setrendertoscreen () 

//create sprite ID 1 with image 1 at zero degree
//our renderimage with the first line and random colours
createsprite(1,1) 

//clone sprite 1 to sprite 2 and so on until sprite 5
For t=1 To 5
	cloneSprite (t+1,1) 
	//draw lines with interval of 60 degrees 
	setspriteangle( t+1,t*60) 
Next t

sync() //refresh screen

sleep (1000) //wait one second

//set a clear screen to the image 1 to delete previous snowflake
SetRenderToImage (1,0) 
ClearScreen()


loop
(AGK version: 2019-02-18)
Submitted: 2019-03-11 15:53:53
// Project: Line_Graphics 
#constant   KEY_ESCAPE	27
#constant   SYNC_RATE	90
#constant   SCREEN_W    1024
#constant   SCREEN_H    768

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "TwoD_Graphics" )
SetWindowSize( 1024, 768, 0 )		// Choose your own size
SetRawMouseVisible(0)				// Hide the mouse
SetWindowAllowResize( 1 ) 			// user can resize the window

// set display properties
SetVirtualResolution( SCREEN_W, SCREEN_H )	// doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 )	// allow both portrait and landscape on mobile devices
SetDisplayAspect(SCREEN_H/SCREEN_W)		// define the display aspect
SetSyncRate( SYNC_RATE, 0 )			// see constant above
SetScissor( 0,0,0,0 )	

SetRandomSeed( timer() )			// 

global Screen_Width as integer = 1024
global Screen_Height as integer = 768
global width_fl as float
global height_fl as float
global col_val as float		// colour value

width_fl = abs(Screen_Width)
height_f1 = abs(Screen_Height)

// EnableClearColor - Stops the frame buffer being cleared on a sync
// Enables the screen to be updated on a sync() command 
// without clearing out previous graphics
EnableClearColor(0)

do
   Draw_curve() // From lines
   CloseApp()  // If you want to use it
   Sync()
   Sleep(300)
   end

loop
function CloseApp()
	
	if GetRawKeyPressed( KEY_ESCAPE )
            End           //Close App
	endif
	
endfunction

Function Draw_Curve()
    // Draws lines to match screen dimensions
    for a = 1 to Screen_Width
        line_colour = a*(255.0/Width_fl)
        drawline( a, 0, Screen_Height, a, 255, line_colour, line_colour)
        sync()
    next a
Endfunction
Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.