Search found 1169 matches

by darkfrei
Sun Mar 24, 2024 11:09 am
Forum: Libraries and Tools
Topic: Parabola functions in Lua
Replies: 10
Views: 87143

Re: Parabola functions in Lua

The parabola is given by focus and directrix. Finding the roots of parabola for given high y: function getFocusParabolaRoots (fx, fy, y) -- focus, horizontal line -- (directrix dirY is global) local h = fx -- x shift local p = -(dirY-fy)/2 -- always negative for voronoi local k = (fy - p) - y -- (fy...
by darkfrei
Wed Mar 13, 2024 8:15 am
Forum: Libraries and Tools
Topic: PNG to outline/contour x,y coordinates - python script
Replies: 3
Views: 702

Re: PNG to outline/contour x,y coordinates - python script

ChatGPT can make Lua / Love2D code as well, also translate one language to other. With mistakes, that is hard to find, yeah.
by darkfrei
Wed Mar 13, 2024 8:09 am
Forum: Support and Development
Topic: push and pop for graphics ?
Replies: 8
Views: 6604

Re: push and pop for graphics ?

[...] You've bumped a 10 year old thread. love.graphics.push ("all") was added to love 9 years ago and does what the OP asks, you should use it instead of that code. Almost 10 years. But we read the wiki graphics.pop yesterday and there was a problem: no information about the color stacki...
by darkfrei
Tue Mar 12, 2024 5:41 pm
Forum: Support and Development
Topic: push and pop for graphics ?
Replies: 8
Views: 6604

Re: push and pop for graphics ?

local function graphicsPushPopGenerator() local states = {} local graphicsPush = function() local currentState = { color = {love.graphics.getColor()}, -- must be table lineWidth = love.graphics.getLineWidth(), pointSize = love.graphics.getPointSize() } table.insert(states, currentState) end local g...
by darkfrei
Tue Mar 12, 2024 3:48 pm
Forum: General
Topic: Gradients (gradient as fill)
Replies: 10
Views: 1674

Re: Gradients (gradient as fill)

Meshes seem to be unnecessary complicated for my use - I am neither using images, nor canvas. I am working with 2D, not 3D. I am drawing polygons directly and using physics functions. I can simulate gradients via repeated drawing of multiplied polygons, but I will have to benchmark performance here...
by darkfrei
Tue Mar 12, 2024 6:26 am
Forum: General
Topic: Gradients (gradient as fill)
Replies: 10
Views: 1674

Re: Gradients (gradient as fill)

Hi, I have searched forums extensively as well as Stack Overflow to find out how to approach gradient drawing. I mostly need it for polygons at the moment, but I am sure it would be useful to have it for any shape. I know there was a discussion regarding this and the best method so far is to use a ...
by darkfrei
Sun Mar 10, 2024 5:27 pm
Forum: General
Topic: Code Doodles!
Replies: 196
Views: 260080

Re: Code Doodles!

Communique Quilts - https://www.google.com/search?q=Communique+Quilts&tbm=isch Examples to usage: city map; levels, that are more than one screen wide and/or more than one screen tall. love.window.setMode(1280, 800) -- Steam Deck resolution local function updatePatches () local index = math.rand...
by darkfrei
Sat Mar 09, 2024 9:18 pm
Forum: General
Topic: Code Doodles!
Replies: 196
Views: 260080

Re: Code Doodles!

First version of patchwork algorithm, it has gabs, but still good for using: Communique Quilts on pinterest: https://www.pinterest.de/search/pins/?q=Communique%20Quilts&rs=typed love.window.setMode(1280, 800) local function updatePatches () local index = math.random(#queue) local point = table.r...
by darkfrei
Mon Mar 04, 2024 9:16 am
Forum: General
Topic: help with snake game lua
Replies: 8
Views: 1289

Re: help with snake game lua

It's my old code : -- License CC0 (Creative Commons license) (c) darkfrei, 2022 UP, RIGHT, DOWN, LEFT = 1, 2, 3, 4 UpdateTime=0.200 Timer = 0 GridSize = 30 GridWidth, GridHeight = 20, 10 local directions = { [UP] = {x= 0, y=-1}, [RIGHT] = {x= 1, y= 0}, [DOWN] = {x= 0, y= 1}, [LEFT] = {x=-1, y= 0}, ...
by darkfrei
Fri Mar 01, 2024 8:56 am
Forum: Support and Development
Topic: 2.5D effect?
Replies: 3
Views: 1036

Re: 2.5D effect?

Pretty simple 2,5D: viewtopic.php?f=3&t=93766