No description
  • Go 73.9%
  • Lua 26.1%
2026-02-02 18:14:04 +01:00
cli Added Color 2025-04-22 12:26:05 +02:00
draw Added Color 2025-04-22 12:26:05 +02:00
drawWrapper New Features and better example 2026-02-02 18:14:04 +01:00
go.mod New Features and better example 2026-02-02 18:14:04 +01:00
go.sum New Features and better example 2026-02-02 18:14:04 +01:00
main.go New Features and better example 2026-02-02 18:14:04 +01:00
README.md Added Links to libs 2025-04-22 12:29:21 +02:00
script.lua New Features and better example 2026-02-02 18:14:04 +01:00

luaDraw

Simple drawing programm using gopher-lua and fenster.

Usage

The default file generated with

./luaDraw gd

--[[
	lua function list:
		* draw:Println(text)     - prints text to console
		* draw:Rect(x, y, w, h, color)  - draws rectangle outline
		* draw:FillRect(x, y, w, h, color) - draws filled rectangle
		* draw:Line(x1, y1, x2, y2, color) - draws line
		* draw:Circle(x, y, radius, color) - draws circle outline
		* draw:ClearScreen() - manually clears screen (not needed with autoclear)
		* draw:KeyDown(key) - check if a key is pressed (follows https://www.toptal.com/developers/keycode)

	lua variable list:
		* Interval int - determines drawing fps (default: 30)
		* AutoClearScreen bool - sets auto clearing of screen (default: true)

	color list:
		* green
		* red
		* blue
		* black
		* white
		* yellow
		* purple
		* orange
]]

function init()
	draw.Interval = 30
	draw:Println("Hello from Lua")
end

local i = 0
local x = 0

function update()
	i = i + 1
	draw:Rect(100 + i , 100, 100, 100, "green")

	if draw:KeyDown(68) then
		x = x+2
	elseif draw:KeyDown(65) then
		x = x-2
	end

	draw:Circle(100+x, 100, 50, "blue")
end

Todo

  • Add onKey events to Lua | Partially done with KeyDown()