Lua libcurl

  • #20, by darren-beckettMonday, 20. March 2017, 17:30 4 years ago
    heh! only problem with that is, if Simon stops to work on creating ved examples & documentation for everything then while he's doing that no work would be done on the engine itself. - more a case of needing additional developers to lighten/spread the workload around.
    I'm 100% sure that Simon doesn't release code without running at least a couple of tests :-)

    My suggestion would be to have a standard VED that any new code can be dropped into, we would then have a tested and runnable example of the new feature.

    We appreciate Simon taking the time to post on the forum, but 5 minutes of his time to produce the example ved, would mean less time replying to us on to the forum.

    Great Poster

    354 Posts


  • #21, by afrlmeMonday, 20. March 2017, 18:23 4 years ago
    heh! only problem with that is, if Simon stops to work on creating ved examples & documentation for everything then while he's doing that no work would be done on the engine itself. - more a case of needing additional developers to lighten/spread the workload around.
    I'm 100% sure that Simon doesn't release code without running at least a couple of tests :-)

    My suggestion would be to have a standard VED that any new code can be dropped into, we would then have a tested and runnable example of the new feature.

    We appreciate Simon taking the time to post on the forum, but 5 minutes of his time to produce the example ved, would mean less time replying to us on to the forum.

    It's never 5 minutes; though I'm aware you are just giving that number as an example. The advanced menu template I created a couple years back took me at least 3 days. Each wiki page I have typed up as taken me minimum 20 minutes & that's for the pages with hardly any content on them. The ones I created with both tutorial & an example ved probably took better part of an afternoon each - it's not simply creating, but checking over what you've written, fixing it & the same goes for documentation as it often takes multiple reads to check for typos & see if it's possible to trim out content filler or edit phrases to make them easier to understand by the most amount of people possible.

    It takes me far less time to reply to a post on the forum - even replying to threads containing questions that have previously been asked in existing threads before - than it does to work on a documentation page in the wiki or create a tutorial. For one I don't have to plan anything out or prep any materials/assets I need.

    Imperator

    6983 Posts

  • #22, by darren-beckettMonday, 20. March 2017, 22:00 4 years ago
    Doing a proper job as you have explained will certainly take time and is certainly required for any newbies or those without a background in development.

    I was just suggesting that the Dev testing could be the starting point. A working example wouldn't need much additional documentation, especially if it's well commented.

    Great Poster

    354 Posts

  • #23, by darren-beckettWednesday, 22. March 2017, 10:15 4 years ago
    Simon, are you there?

    I can't get the sprite to display:
    -- Download image to memory 
    downloadMemory(imageUrl, function(s, param)
     local pos = string.find(string.reverse(imageUrl), "%.") -- Find Last fullstop
     local imageType = string.upper(string.sub(imageUrl, string.len(imageUrl) - pos +2))

     print("ImageType: ", imageType)
     if imageType == "JPG" then
        sprite = graphics.loadMemoryJPG(s)
     elseif imageType == "PNG" then
        sprite = graphics.loadMemoryPNG(s)
     elseif imageType == "WEBP" then
        sprite = graphics.loadMemoryWEBP(s)
     end

     if sprite == nil then
        print("Sprite is null")
     end
     --sprite.position = {x = 300, y = 300}
     graphics.drawSprite(sprite)
     print("Image should be shown")
    end)
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21

    No errors, Sprite is not null

    Ideally, i would like to assign the new sprite to an existing scene object

    Great Poster

    354 Posts

  • #24, by darren-beckettMonday, 27. March 2017, 10:08 4 years ago
    Can anybody help with this?

    Great Poster

    354 Posts

  • #25, by SimonSMonday, 27. March 2017, 14:01 4 years ago
    The sprite needs to be drawn every frame via the draw callback.

    Thread Captain

    1438 Posts

  • #26, by darren-beckettMonday, 27. March 2017, 14:08 4 years ago
    Ok, How is this done?

    Great Poster

    354 Posts

  • #27, by darren-beckettTuesday, 28. March 2017, 12:02 4 years ago
    Help?

    Great Poster

    354 Posts

  • #28, by SimonSTuesday, 28. March 2017, 12:13 4 years ago
    You already used the code: (by the way, the function name will change to addDrawFunc in Vis 5)

    function draw()
      if sprite ~= nil then
        graphics.drawSprite(sprite)
      end
    end
    <span>
    graphics.setDrawFunc("draw()")</span>
    1
    2
    3
    4
    5
    6
    7
    8

    Thread Captain

    1438 Posts

  • #29, by darren-beckettTuesday, 28. March 2017, 16:39 4 years ago
    Thanks.
    I now have something being shown (It's flickering), but at least something has happened.

    Is it possible to set this sprite to an existing scene object? 
    or set an action to occur when the sprite is clicked?

    Great Poster

    354 Posts

  • #30, by SimonSTuesday, 28. March 2017, 17:28 4 years ago
    No, you need to change the position yourself:

    sprite.position = {x=0,y=0}

    Also you need to listen yourself for events. Easiest way would be putting an object border there.

    Thread Captain

    1438 Posts

Write post