Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. i'm still working on my project to implement a Processing-like API in Lua/Love2d.

i'm still working on my project to implement a Processing-like API in Lua/Love2d.

Scheduled Pinned Locked Moved Uncategorized
116 Posts 2 Posters 202 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • exquisitecorp@merveilles.townE This user is from outside of this forum
    exquisitecorp@merveilles.townE This user is from outside of this forum
    exquisitecorp@merveilles.town
    wrote on last edited by
    #1

    i'm still working on my project to implement a Processing-like API in Lua/Love2d. I have added a majority (?) of the functions, including a number I never use. Because love2d clears the screen between drawing functions I chose to add in persistence using a canvas buffer system that redraws each frame. Here's an example drawing random rectangles with occasional background screen redraw.

    exquisitecorp@merveilles.townE 1 Reply Last reply
    0
    • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

      i'm still working on my project to implement a Processing-like API in Lua/Love2d. I have added a majority (?) of the functions, including a number I never use. Because love2d clears the screen between drawing functions I chose to add in persistence using a canvas buffer system that redraws each frame. Here's an example drawing random rectangles with occasional background screen redraw.

      exquisitecorp@merveilles.townE This user is from outside of this forum
      exquisitecorp@merveilles.townE This user is from outside of this forum
      exquisitecorp@merveilles.town
      wrote on last edited by
      #2

      ok, i've gotten the API to a draft state and am pretty happy with what i have. of course, i'm aware that i've done 80% of the work in 20% of the time (or however that's stated) so the tiny details will take days/months/years. but i'm already pretty happy with this pre-alpha. i'm ready to start trying to make little programs and put it through its paces.

      exquisitecorp@merveilles.townE 1 Reply Last reply
      0
      • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

        ok, i've gotten the API to a draft state and am pretty happy with what i have. of course, i'm aware that i've done 80% of the work in 20% of the time (or however that's stated) so the tiny details will take days/months/years. but i'm already pretty happy with this pre-alpha. i'm ready to start trying to make little programs and put it through its paces.

        exquisitecorp@merveilles.townE This user is from outside of this forum
        exquisitecorp@merveilles.townE This user is from outside of this forum
        exquisitecorp@merveilles.town
        wrote on last edited by
        #3

        i'm still going. i got most (?) or at least a lot of the Processing/p5.js API done. I also modified the love.run() function so that the screen isn't cleared between frames but the matrix transformations are, to get it in line with Processing. I added many functions, cleaned up things, and started testing the functions i implemented. still to come: error handling and general bug fixin'

        Link Preview Image
        exquisitecorp@merveilles.townE 1 Reply Last reply
        0
        • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

          i'm still going. i got most (?) or at least a lot of the Processing/p5.js API done. I also modified the love.run() function so that the screen isn't cleared between frames but the matrix transformations are, to get it in line with Processing. I added many functions, cleaned up things, and started testing the functions i implemented. still to come: error handling and general bug fixin'

          Link Preview Image
          exquisitecorp@merveilles.townE This user is from outside of this forum
          exquisitecorp@merveilles.townE This user is from outside of this forum
          exquisitecorp@merveilles.town
          wrote on last edited by
          #4

          i wrote a crude pong in L5. maybe i still need a better title for this library of Processing API in Lua with Love2d. (any suggestions?)

          (music by Hildegard Von Bingen of course)

          exquisitecorp@merveilles.townE 1 Reply Last reply
          0
          • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

            i wrote a crude pong in L5. maybe i still need a better title for this library of Processing API in Lua with Love2d. (any suggestions?)

            (music by Hildegard Von Bingen of course)

            exquisitecorp@merveilles.townE This user is from outside of this forum
            exquisitecorp@merveilles.townE This user is from outside of this forum
            exquisitecorp@merveilles.town
            wrote on last edited by
            #5

            ok, i'm stopping for the night. the next things to do are to add typography functions, full mouse functions, and color modes, then I think that will be most of the API complete. I will still need to do bug testing.

            Tonight I ran up against a problem I couldn't quite solve. I am using @Alexjgriffith suggestion to modify love2d's love.run() game loop and modified the default loop to not clear the screen between draw calls. Unfortunately, when drawing graphics from events (such as keyPressed(), keyTyped() ) the screen flickers, I think because of double drawing. I tried half a dozen different solutions but never quite found a satisfactory one unfortunately.

            exquisitecorp@merveilles.townE 1 Reply Last reply
            0
            • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

              ok, i'm stopping for the night. the next things to do are to add typography functions, full mouse functions, and color modes, then I think that will be most of the API complete. I will still need to do bug testing.

              Tonight I ran up against a problem I couldn't quite solve. I am using @Alexjgriffith suggestion to modify love2d's love.run() game loop and modified the default loop to not clear the screen between draw calls. Unfortunately, when drawing graphics from events (such as keyPressed(), keyTyped() ) the screen flickers, I think because of double drawing. I tried half a dozen different solutions but never quite found a satisfactory one unfortunately.

              exquisitecorp@merveilles.townE This user is from outside of this forum
              exquisitecorp@merveilles.townE This user is from outside of this forum
              exquisitecorp@merveilles.town
              wrote on last edited by
              #6

              since i am stuck on the flickering background color problem i decided to take a break from that. so this afternoon i implemented a toColor() system so that one can input color names in the same variety of ways that p5.js does: using a html color name - it's glorious to use Rebecca Purple, Lawn Green, Dodger Blue, Mintcream isn't it?, as well as R,G,B, or R,G,B,A or grayness or grayness,A. later i will add in some other modes like HSB

              Link Preview Image
              exquisitecorp@merveilles.townE 1 Reply Last reply
              0
              • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                since i am stuck on the flickering background color problem i decided to take a break from that. so this afternoon i implemented a toColor() system so that one can input color names in the same variety of ways that p5.js does: using a html color name - it's glorious to use Rebecca Purple, Lawn Green, Dodger Blue, Mintcream isn't it?, as well as R,G,B, or R,G,B,A or grayness or grayness,A. later i will add in some other modes like HSB

                Link Preview Image
                exquisitecorp@merveilles.townE This user is from outside of this forum
                exquisitecorp@merveilles.townE This user is from outside of this forum
                exquisitecorp@merveilles.town
                wrote on last edited by
                #7

                added 3 and 6 digit hex color codes as well.

                exquisitecorp@merveilles.townE 1 Reply Last reply
                0
                • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                  added 3 and 6 digit hex color codes as well.

                  exquisitecorp@merveilles.townE This user is from outside of this forum
                  exquisitecorp@merveilles.townE This user is from outside of this forum
                  exquisitecorp@merveilles.town
                  wrote on last edited by
                  #8

                  added frameRate() function.

                  while working on all this, had a bit of a think. i believe my flickering screen problem is a result of me hacking Love2d to work more like processing/p5. in the processing model, the approach is a synchronous model. draw runs once per frame. if too much processing happens, it slows down/frame rate drops. love2d takes the approach of drawing as many times as needed per game loop. logic is separated out into update(), while drawing is rendered in a separate thread, so game logic doesn't block rendering and realtime logic can be processed. In love2d, the emphasis is on realtime game processes.:

                  exquisitecorp@merveilles.townE 1 Reply Last reply
                  0
                  • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                    added frameRate() function.

                    while working on all this, had a bit of a think. i believe my flickering screen problem is a result of me hacking Love2d to work more like processing/p5. in the processing model, the approach is a synchronous model. draw runs once per frame. if too much processing happens, it slows down/frame rate drops. love2d takes the approach of drawing as many times as needed per game loop. logic is separated out into update(), while drawing is rendered in a separate thread, so game logic doesn't block rendering and realtime logic can be processed. In love2d, the emphasis is on realtime game processes.:

                    exquisitecorp@merveilles.townE This user is from outside of this forum
                    exquisitecorp@merveilles.townE This user is from outside of this forum
                    exquisitecorp@merveilles.town
                    wrote on last edited by
                    #9

                    it is 2am and i have at least temporarily nipped this one in the bud. i'm worried there's some edge case i haven't addressed, but i have tried a bunch of tests and so far i'm hoping this sticks. i do not have the jittering/framebuffering issues anymore, all events and setup are able to draw to canvas, with or without any other functions. in the end, i'm worried i made my code a bit hacky - for example, i am running setup code twice , where the second time the graphics are being drawn. i think there's room for improvement and cleanup later, but i'm glad to have gotten through this block.

                    Link Preview Image
                    exquisitecorp@merveilles.townE 1 Reply Last reply
                    0
                    • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                      it is 2am and i have at least temporarily nipped this one in the bud. i'm worried there's some edge case i haven't addressed, but i have tried a bunch of tests and so far i'm hoping this sticks. i do not have the jittering/framebuffering issues anymore, all events and setup are able to draw to canvas, with or without any other functions. in the end, i'm worried i made my code a bit hacky - for example, i am running setup code twice , where the second time the graphics are being drawn. i think there's room for improvement and cleanup later, but i'm glad to have gotten through this block.

                      Link Preview Image
                      exquisitecorp@merveilles.townE This user is from outside of this forum
                      exquisitecorp@merveilles.townE This user is from outside of this forum
                      exquisitecorp@merveilles.town
                      wrote on last edited by
                      #10

                      Don't want to jinx myself but I think I'm nearing completion of what I've set for my first run implementation of Processing API in Lua (via Love2d). I need to add in typography styling, some input/output options, and then probably have some drawing buffer debugging to do (which has been the most difficult thing for me to work through so far).

                      Today I added in describe() mode from p5.js and decided to try having it output text to the console for CLI screenreaders, but I need to look into more best practices for this.

                      I also implemented color tables, getting and setting colors, screenshotting (save() ) , smoothing/noSmoothing, strokeCaps, strokeJoins, displayWidth, displayHeight, millis(), mouseWheel() function.

                      exquisitecorp@merveilles.townE 1 Reply Last reply
                      0
                      • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                        Don't want to jinx myself but I think I'm nearing completion of what I've set for my first run implementation of Processing API in Lua (via Love2d). I need to add in typography styling, some input/output options, and then probably have some drawing buffer debugging to do (which has been the most difficult thing for me to work through so far).

                        Today I added in describe() mode from p5.js and decided to try having it output text to the console for CLI screenreaders, but I need to look into more best practices for this.

                        I also implemented color tables, getting and setting colors, screenshotting (save() ) , smoothing/noSmoothing, strokeCaps, strokeJoins, displayWidth, displayHeight, millis(), mouseWheel() function.

                        exquisitecorp@merveilles.townE This user is from outside of this forum
                        exquisitecorp@merveilles.townE This user is from outside of this forum
                        exquisitecorp@merveilles.town
                        wrote on last edited by
                        #11

                        i had temporarily for a day or two jinxed myself but i was able to figure out font loading and textSize, and other typography functions to emulate the processing api / flow (maintaining state).

                        next i turn to input/output (importing and exporting strings/json/tables?).

                        exquisitecorp@merveilles.townE 1 Reply Last reply
                        0
                        • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                          i had temporarily for a day or two jinxed myself but i was able to figure out font loading and textSize, and other typography functions to emulate the processing api / flow (maintaining state).

                          next i turn to input/output (importing and exporting strings/json/tables?).

                          exquisitecorp@merveilles.townE This user is from outside of this forum
                          exquisitecorp@merveilles.townE This user is from outside of this forum
                          exquisitecorp@merveilles.town
                          wrote on last edited by
                          #12

                          completed! loadStrings(), saveStrings(), loadTable(), and saveTable() complete. And current data formats are csv, tsv and lua.
                          I considered adding in a loadJSON() function, and still could at some point, but didn't think it made sense to DIY build a basic JSON parser or drop in something now. Could always be added later.

                          And with that, i've pretty much finished most of this first draft of implementing the API. there's a few remaining color modes to add in: HSB, a noise function, some vertex functions, and then lots of debugging and refactoring. notably, i have not tested on a Mac or Windows machine yet, or any computer other than my own! I also need to review how i'm implementing drawing from setup(). my current method is a bit dumb and draws twice. but ultimately, feeling pretty good about the library so far.

                          exquisitecorp@merveilles.townE 1 Reply Last reply
                          0
                          • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                            completed! loadStrings(), saveStrings(), loadTable(), and saveTable() complete. And current data formats are csv, tsv and lua.
                            I considered adding in a loadJSON() function, and still could at some point, but didn't think it made sense to DIY build a basic JSON parser or drop in something now. Could always be added later.

                            And with that, i've pretty much finished most of this first draft of implementing the API. there's a few remaining color modes to add in: HSB, a noise function, some vertex functions, and then lots of debugging and refactoring. notably, i have not tested on a Mac or Windows machine yet, or any computer other than my own! I also need to review how i'm implementing drawing from setup(). my current method is a bit dumb and draws twice. but ultimately, feeling pretty good about the library so far.

                            exquisitecorp@merveilles.townE This user is from outside of this forum
                            exquisitecorp@merveilles.townE This user is from outside of this forum
                            exquisitecorp@merveilles.town
                            wrote on last edited by
                            #13

                            I'm building in documentation and example programs as I go. Here's the most complex one so far, a basic implementation of OOP with a robots class via metamethods

                            Link Preview Image
                            exquisitecorp@merveilles.townE 1 Reply Last reply
                            0
                            • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                              I'm building in documentation and example programs as I go. Here's the most complex one so far, a basic implementation of OOP with a robots class via metamethods

                              Link Preview Image
                              exquisitecorp@merveilles.townE This user is from outside of this forum
                              exquisitecorp@merveilles.townE This user is from outside of this forum
                              exquisitecorp@merveilles.town
                              wrote on last edited by
                              #14

                              fiinished up a heckuva of a lot of the API and have been doing some tests (still need to do some more). I still need to add in colormodes HSB, HSA and a few related functions and then that'll be the first draft of L5. i am ignoring vertex functions for now (I could'nt quite wrap my head around it yet) and need to fix arcs.

                              I started building out intro documentation yesterday. I saw Casey and Lauren today and told them about the project and will share it with them hopefully soon. Lauren asked me about what if it catches on and I'm working on this for years and years lol.

                              Now I'm starting to think through documentation and reference sites. I looked at how they build the sites for Processing and p5 and I don't quite want to have to learn JSX and MDX. It's probably not too bad but I'm hoping for something much simpler at first. I can always build it out further later.

                              exquisitecorp@merveilles.townE 1 Reply Last reply
                              0
                              • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                                fiinished up a heckuva of a lot of the API and have been doing some tests (still need to do some more). I still need to add in colormodes HSB, HSA and a few related functions and then that'll be the first draft of L5. i am ignoring vertex functions for now (I could'nt quite wrap my head around it yet) and need to fix arcs.

                                I started building out intro documentation yesterday. I saw Casey and Lauren today and told them about the project and will share it with them hopefully soon. Lauren asked me about what if it catches on and I'm working on this for years and years lol.

                                Now I'm starting to think through documentation and reference sites. I looked at how they build the sites for Processing and p5 and I don't quite want to have to learn JSX and MDX. It's probably not too bad but I'm hoping for something much simpler at first. I can always build it out further later.

                                exquisitecorp@merveilles.townE This user is from outside of this forum
                                exquisitecorp@merveilles.townE This user is from outside of this forum
                                exquisitecorp@merveilles.town
                                wrote on last edited by
                                #15

                                Anyone have a suggestion for building a programming language documentation and reference site? particularly that's beginner-friendly, emphasizes the reference, and makes it easy to handle/build a reference page for all of the language's functions? written in markdown, produces static pages, and can be hosted on a git forge and collaboratively built with others.

                                I am currently looking at:

                                * hugo documentation themes
                                * MKDocs
                                * adapting my own static site generator again - though this may not be robust enough over time
                                * i keep reading about documentation generators but i don't really grok the idea yet

                                exquisitecorp@merveilles.townE 1 Reply Last reply
                                0
                                • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                                  Anyone have a suggestion for building a programming language documentation and reference site? particularly that's beginner-friendly, emphasizes the reference, and makes it easy to handle/build a reference page for all of the language's functions? written in markdown, produces static pages, and can be hosted on a git forge and collaboratively built with others.

                                  I am currently looking at:

                                  * hugo documentation themes
                                  * MKDocs
                                  * adapting my own static site generator again - though this may not be robust enough over time
                                  * i keep reading about documentation generators but i don't really grok the idea yet

                                  exquisitecorp@merveilles.townE This user is from outside of this forum
                                  exquisitecorp@merveilles.townE This user is from outside of this forum
                                  exquisitecorp@merveilles.town
                                  wrote on last edited by
                                  #16

                                  there's not too much to this sketch, but it's fun trying out rapid code sketching with the language now

                                  code:
                                  require("L5")

                                  function setup()
                                  size(1920,1280)
                                  windowTitle("Flag Thing")

                                  noStroke()
                                  createPage()

                                  frameRate(1)
                                  end

                                  function draw()
                                  createPage()
                                  end

                                  function createPage()
                                  background(random(255),random(255),random(255))
                                  fill(random(255),random(255),random(255))
                                  circle(width/2,height/2,2/3*height)
                                  end

                                  exquisitecorp@merveilles.townE 1 Reply Last reply
                                  0
                                  • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                                    there's not too much to this sketch, but it's fun trying out rapid code sketching with the language now

                                    code:
                                    require("L5")

                                    function setup()
                                    size(1920,1280)
                                    windowTitle("Flag Thing")

                                    noStroke()
                                    createPage()

                                    frameRate(1)
                                    end

                                    function draw()
                                    createPage()
                                    end

                                    function createPage()
                                    background(random(255),random(255),random(255))
                                    fill(random(255),random(255),random(255))
                                    circle(width/2,height/2,2/3*height)
                                    end

                                    exquisitecorp@merveilles.townE This user is from outside of this forum
                                    exquisitecorp@merveilles.townE This user is from outside of this forum
                                    exquisitecorp@merveilles.town
                                    wrote on last edited by
                                    #17
                                    This post did not contain any content.
                                    Link Preview Image
                                    exquisitecorp@merveilles.townE 1 Reply Last reply
                                    0
                                    • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town
                                      This post did not contain any content.
                                      Link Preview Image
                                      exquisitecorp@merveilles.townE This user is from outside of this forum
                                      exquisitecorp@merveilles.townE This user is from outside of this forum
                                      exquisitecorp@merveilles.town
                                      wrote on last edited by
                                      #18

                                      on a whim i decided to port over my Pico-8 quilt generator to my L5 language. took only maybe 15 minutes. the colors are quite ugly on this one!

                                      Link Preview Image
                                      exquisitecorp@merveilles.townE 1 Reply Last reply
                                      0
                                      • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                                        on a whim i decided to port over my Pico-8 quilt generator to my L5 language. took only maybe 15 minutes. the colors are quite ugly on this one!

                                        Link Preview Image
                                        exquisitecorp@merveilles.townE This user is from outside of this forum
                                        exquisitecorp@merveilles.townE This user is from outside of this forum
                                        exquisitecorp@merveilles.town
                                        wrote on last edited by
                                        #19

                                        as much as i love kludgy dynamic programming languages sheesh i really got myself tonight. i was spending 30 minutes trying to debug some wild-ass bug i couldn't make heads or tails of, even when trying to just print it out, and then of course later i realize i had a function and a variable name collision. smh

                                        exquisitecorp@merveilles.townE 1 Reply Last reply
                                        0
                                        • exquisitecorp@merveilles.townE exquisitecorp@merveilles.town

                                          as much as i love kludgy dynamic programming languages sheesh i really got myself tonight. i was spending 30 minutes trying to debug some wild-ass bug i couldn't make heads or tails of, even when trying to just print it out, and then of course later i realize i had a function and a variable name collision. smh

                                          exquisitecorp@merveilles.townE This user is from outside of this forum
                                          exquisitecorp@merveilles.townE This user is from outside of this forum
                                          exquisitecorp@merveilles.town
                                          wrote on last edited by
                                          #20

                                          with a bit of a whimper at the end of a friday night here i have implemented 99% of the API to an unpolished, un-refactored state. I've also assembled a bit of a TODO list so I can go in and start cleaning things up.

                                          Today I added in colorMode() which lets you change between RGB, HSB and HSL. I thought I had it, but since I'm trying to emulate Processing and p5.js I always test against their outcomes and was dismayed to learn that using a html color name in p5.js even in another color mode should always output in RGB. And while this makes complete sense, I kept getting strange color output when rendering "orange" in HSL mode for example. I'm guessing my color juggling is off somewhere because it goes like this:

                                          code:
                                          colormode(HSL)
                                          fill("orange")
                                          square(0,0,100)

                                          behind the scenes:
                                          1. change global color mode state to HSL and max vals for HSLA are 360,100,100,100 default
                                          2. retrieve orange as RGB(A) values. convert that to "orange" in HSL.
                                          3. draw the square in that fill color
                                          ..
                                          4. Hmm, yellow appears instead?

                                          The problem exists between 2 and 3 (as well as between my ears).

                                          exquisitecorp@merveilles.townE 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups