CodeaShowcase (update: v2.210)

but for me it just says loading

here is version 2:

This version has many new features, among which:

  • the links are saved in a ‘links’ tab easy to copy and share.
  • the loads of code needed to run this are hidden and saved in a local variable, and you can update it or delete it.
  • edit the links extensively from the project.
  • save locally the loaded code for offline use (those ones are colored violet).
  • you can add new screens easily.
  • many more great links in my collection.
  • in the settings select FlashRun to just run the projects, without the message windows.
  • and more…

A couple videos to illustrate:
http://www.youtube.com/watch?v=AkVJnpL4S7k
http://www.youtube.com/watch?v=FYlyMmugNfU


--# libLoader
-- libLoader

local function run(data)
    resetMatrix()
    resetStyle()
    loadstring( data )()
    print("xfcCodeaShowcase")
    setup()
end

local function success(data,status,headers)
 --   pasteboard.text = data
    saveGlobalData("xfcCodeaShowcase",data)
    tween.delay(0.1,function()
        print("ready")
        run(data)
    end)
end
local function fail(data,status,headers)
    print("load failed")
    print(data)
    print(status)
end
function loadLibrary()
    local data = readGlobalData("xfcCodeaShowcase")
    if data ==  nil then
        url = "http://jmv38.comze.com/CODEA_4/xfcCodeaShowcase.txt"
        print("starting request")
        http.request(url,success,fail)
    else
        run(data)
    end
end



--# Main
-- Main.lua
--supportedOrientations(LANDSCAPE_ANY)

function setup()
    if xfc then 
        init()
    else
        print("loading xfcCodeaShowcase ...")
        loadLibrary()
    end
end


function draw()
    if Screen then Screen:draw() end
end

function touched(t)
    if Screen then Screen:touched(t) end
end



@Jmv38 When you save a project for offline viewing, it stops being available the next time you run the QPV. Also, the pre-saved ones don’t work until you save them manually.

@Saturn031000.
1/ The saved projects are available only from QPV, not from codea main board. If you want to have them in codea, you must tap ‘copy’ then leave QPV, then paste it into a new codea project.
2/ The pre-saved ones are not saved until you save them manually. It takes memory in your iPad, so you probably dont want them all, and i cant know the ones you want to save?
So i thinks it works as expected on your side.
Thanks.

[edit] reading your post again: i think my answer does not correspond to your question in 1/. Are you sure you chose to save the project after you have loaded it? It doesnt save automatically.

@Jmv38 To clarify my first point, I meant that if you save a project for offline use, then return to the editor, then run the QPV again, it appears as not saved.

Otherwise, great work (especially with the FlashRun setting)!

@Saturn031000 Concerning this problem can you list exactly your actions 1 by 1? It works fine on my side. Also which ipad and ios version do you have?

[edit] i have reproduced it. I’ll check what is going on.
Thanks.

I’ve nailed it! Dont use local save for the moment.

It should be fixed now!
How to upgrade:

  • tap the settings.
  • tap ‘force update’.
  • wait 10s (there is not good user feedback here, i should improve that).
  • exit, run again.
    now it should work. Let me know.

The bug was that i was restarting each time from my original links, not from the links tab saved in your project.

version 2.1 (01) issued:

  • better management of updates: user information and auto restart.
  • current version visible in settings

@Jmv38 Brilliant!

What about an option to reset the positions of the message boxes, etc.?

@Satirn031000 what do you mean?

@Jmv38 When you get a message box, if you hit the lock button, you can resize and move the box. In the first version the positions would get saved every time the QPV was run. That doesn’t seem to happen in v2.0/2.1, but if it did, then an option to reset the location and size of it is what I meant.

I see. In the second version the positions are still saved if you move them, but because i have put everything into a separate library, the local data is overwriten by the library data (as it did for the links). So it will be ok now.

#####Update version 2.2.
Now when you run a project, a stop button appears on bottom left. Tap it to return to previuos screen: the exploration is more fluid.
To update tap ‘force update’ in the settings.
[edit] doesnt work perfectly with 3d projects. the STOP botton is not visible, but still there, so you can tap it to exit.

version 2.2 (01): technical changes vs 2.2 above to improve stability.

version 2.2 (02): technical changes to improve stability. Some projects failed because they change some codea native function (fontSize() redefined as a number for instance). Now i call the stop button with pcall and they dont fail any more.

Big update: 2.2(06).

-- 2.206
-- improved startup speed: screens are filled up on open only

-- 2.205
-- made 2 libraries : user and mine

-- 2.204
-- now loads CC links too (thanks to @Toffer)

-- 2.203
-- export your lib for sharing (new button in settings)

There are also many more projects in my library now.

To update:

  • you can copy the code below.
  • and make sure to tap settings / CLEAR local
  • restart.
    to get version 2.206 running.
    (force update does not seem to work correctly)

--# libLoader
-- libLoader

local function run(data)
    resetMatrix()
    resetStyle()
    loadstring( data )()
    print("xfcCodeaShowcase")
    setup()
end

local function success(data,status,headers)
 --   pasteboard.text = data
    saveGlobalData("xfcCodeaShowcase",data)
    tween.delay(0.1,function()
        print("ready")
        run(data)
    end)
end
local function fail(data,status,headers)
    print("load failed")
    print(data)
    print(status)
end
function loadLibrary()
    local data = readGlobalData("xfcCodeaShowcase")
    if data ==  nil then
        url = "http://jmv38.comze.com/CODEA_4/xfcCodeaShowcase.txt"
        print("starting request")
        http.request(url,success,fail)
    else
        run(data)
    end
end



--# Main
-- Main.lua
--supportedOrientations(LANDSCAPE_ANY)

function setup()
    if xfc then 
        init()
    else
        print("loading xfcCodeaShowcase ...")
        loadLibrary()
    end
end


function draw()
    if Screen then Screen:draw() end
end

function touched(t)
    if Screen then Screen:touched(t) end
end



--# links
-- links
    
links = {}
local function ins(t) table.insert(links,t) end


ins { typ = "screen"}



ins { typ = "title", txt = "<< tap to edit title" }


ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }


ins { typ = "title", txt = "" }


ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }


ins { typ = "title", txt = "" }


ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }


ins { typ = "title", txt = "" }


ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

ins { typ = "link", txt = "" }

-- 2.208
-- flash run works for links too
-- corrected a bug when project does not redefine touched, my buttons were still there
-- the force library update should work now

to update tap / settings / CLEAR local lib /, then restart

@Jmv38 The share feature is really useful. One suggestion, have a clear local save button.

@saturn031000 thanks.
What do you mean exactly? ’ have a clear local save button’