Calling Codeslinger

Hi All,

Hoping to get Codeslingers attention - I have a problem with loveCodea. That is I don’t seem to be able to fill ellipses by using the following code:


Hope it’s not me being a little slow.

If anyone can help I’d appreciate it - I like to prototype on my PC as I find it easier to edit with.



Or am I a being a little slow? Codea is just one of my many interests, so it takes time …

Löve cannot draw ellipses, so they are drawn by hand (well, by algorithm). The function is still the one that came with loveCodify and it can only draw outlines.

But it’s good you’re asking for it. I’m currently looking at the new version of BattleChips and it looks as if I might need filled ellipses as well. (Don’t try it yet, Mark did some fancy stuff that is absolutely not rendered properly with loveCodea. If you do anyway, set the background color in draw() to some shade of gray to see something.)

Here’s a hot fix for filled ellipses:

function ellipse(x, y, width, height)

    if height == nil or width == height then
        local radius = width
        if _ellipsemode == CENTER then radius = width / 2 end
        if _fillmode == "fill" then
  "fill", x, y, radius, 50)
        local lw = _strokewidth"line", x, y, radius - lw / 2, 50)
        if _fillmode == "fill" then
            ellipse2("fill", x, y, width/2, height/2)
        ellipse2("line", x, y, width/2, height/2)

-- Love2d does not have a ellipse function, so we have todo it by ourself
-- a & b are axis-radius
function ellipse2(mode, x, y, a, b) --,stp,rot)
    local stp=50
    local rot=0
    local m,rad,sa,ca,sb,cb,x1,y1,ast
    m = math; rad = m.pi/180; ast = rad * 360/stp;
    sb = m.sin(-rot * rad); cb = m.cos(-rot * rad)
    local vertices = {}
    for n = 1, stp do
        sa = m.sin(ast*n) * b
        ca = m.cos(ast*n) * a
        x1 = x + ca * cb - sa * sb
        y1 = y + ca * sb + sa * cb
        table.insert(vertices, x1)
        table.insert(vertices, y1)
    end, vertices)

Hi Codeslinger,

Thanks for the prompt feedback !!

‘Hope it’s not me being a little slow’. - that’s an apology if I was pestering when I could have made a stupid/obvious mistook (I have been known to make 'em).

Thanks for the hot fix - I’ll try them out and let you know how it goes. Thanks for the help loveCodea is a real boon for me.

Before I go - have you a list of the features not implemented in loveCodea, that would stop me (and others) pestering for updates.

Thanks again.



@Bri_G I have made a couple of small changes to loveCodea. I implemented close(),clip(), and made WIDTH&HEIGHTreturn non-hardcoded values. How would you like patches submitted?

Hi JockM,

That’s fantastic - best thing to do, if he’s amenable, is to pass them through Codeslinger then they can be checked for compatibility before release to the rest of the Codea population. You could also post your code so that other Codea users can see how it’s done - this should be a community project.

Thanks for the contribution.



@Bri_G oops I meant to address that to @Codeslinger and got distracted by something bright and shiny :wink: Mea Culpa

JockM, just post it where I can find it. Inline in this forum, in a pastebin, where ever. Perhaps with an example usage. I usually do the work on loveCodea based on what needs to be done to get some existing stuff working.

Bri_G, I haven’t checked how large the Codea API actually is, so I don’t want to make a list. 3D is far away on Löve2D (!), I haven’t looked at the physics API, so this is a huge “maybe”. You see, not really a list. I keep posting the games and examples that work with the wrapper.

@Codeslinger That is basically the same way I am working on loveCodea as well. So far I have done:

  • close()
  • readProjectData() – only for strings
  • saveProjectData() – only for strings
  • clip()
  • enhanced to fill(), stroke(), strokeWidth, and tint() to return the current value

I’ll toss it up somewhere for you soon.

@Codeslinger You can find a zip of my enhancements here.

In addition to the enhancements I described in my previous post I have made a curde first cut at sound support. I used csfxr to make a set of basic sounds and saved them to OGG files (since Löve2d has some issues with non OGG files), for things like blit, jump, etc. These are included in the ZIP file.

I haven’t downloaded your latest update yet, so you will want to be aware of that as you reconcile the differences.

My next task is to see if I can get soundBuffer() to work…