Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Codea 2.0 Beta

1235717

Comments

  • Posts: 2,820

    @JakAttak - I think he's doing something with meta tables to return a function when you call it, but I'm not quite sure. Don't take my word of that. I don't have my iPad, so I can't go digging.
    Another thing you might try is setting a hook on the "music" function.

  • Posts: 2,043

    I won't even pretend to know how meta tables work :P

  • IgnatzIgnatz Mod
    Posts: 5,396

    @JakAttak - I'm no expert either, but here is a basic explanation

    http://coolcodea.wordpress.com/2013/07/21/96-meta-what-metatables-explained/

  • edited January 2014 Posts: 2,043

    @Ignatz, thanks. After some googling and guess and check I figured out that it is the metatables __call function that is being called and so I came up with this:

    local _mt = getmetatable(music)
    local _music = _mt.__call
    
    _mt.__call = function(a, track, ...)
        print("Playing track:", track)
        currentMusic = track
        _music(a, track, ...)
    end
    
    setmetatable(music, _mt)
    

    Seems to work.

  • Posts: 2,820

    Haha. My guess was a shot in the dark. Glad it worked. :)

  • Posts: 2,820

    The key stroke Command-Alt-Up or down is not working.
    Thanks!

  • SimeonSimeon Admin Mod
    Posts: 5,416

    @Zoyt what is Cmd+Alt+Up/Down supposed to do?

  • Posts: 2,820

    @Simeon - Whoops! I meant Shift+Alt+Up and down to move the cursor one line above in the save position on the X axis. Sorry.

  • SimeonSimeon Admin Mod
    Posts: 5,416

    Shouldn't the cursor preserver the X position when you just use up and down (unless the line length differs)?

    I am trying this key combination on TextEdit (Mac) and it appears to do nothing.

  • Posts: 2,820

    @Simeon - It behaves a bit differently, but on the Mac, it selects the line above like this:
    https://dl.dropboxusercontent.com/u/91357336/Forum Misc/TextEditShiftAltArrow.mov
    Thanks!

  • Posts: 2,043

    Not sure if this is a bug or not, but I was under the impression that if a touch went off the screen, it's state would be CANCELLED. I'm not seeing that happen.

  • SimeonSimeon Admin Mod
    Posts: 5,416

    CANCELLED gets called for system interruptions (alerts popping up, phone calls, stuff like that). Moving off the screen will trigger ENDED.

  • Posts: 2,043

    @Simeon, I'm not seeing it trigger either. In the multi touch example, moving off the screen causes the dot to become stuck, rather than disappearing like it does on ENDED.

  • SimeonSimeon Admin Mod
    Posts: 5,416

    @JakAttak strange, when I open the multi-touch example and move touches past the edge of the display they disappear. Does this happen every time for you?

  • Posts: 2,043

    @Simeon, you are right they do seem to work normally. I was using Briarfox's universal app emulator to test, and then it doesn't work, and I'm wondering if this means it won't work on iPhone after export?

  • SimeonSimeon Admin Mod
    Posts: 5,416

    I'm not sure how @Briarfox's universal app emulator works, but I imagine the touches don't actually go off the edge of the device when they go off the edge of the fake iPhone screen?

  • Posts: 2,043

    They do not. They simply go past WIDTH or HEIGHT.

  • SimeonSimeon Admin Mod
    Posts: 5,416

    It will not correctly update the touch state in that case. On an actual device, going off the screen is the same as lifting your finger.

  • Posts: 2,043

    Ok thanks for clarifying.

  • Posts: 2,043

    Just got build 17. Thanks for putting in music.name

  • Posts: 505

    Thanks for the shader compilation error print, thats a great feature. :)

    Got the shaderlab to crash, just added a uniform vec2 pts to a new vertex shader. Can you use uniform arrays in codea? Havent got it working..

  • Posts: 2,161

    When I ran a project with an error, I got:

    attempt to concatenate upvalue '_this...
    

    The line itself just says local x,y,lh.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    @Simeon backingmode(RETAINED) does not seem to be working. draw() is still running 60fps.

  • Posts: 2,820

    Attempting to print a vec2 from the console raises an error.
    Just a suggestion: It'd be great if the user could summon the tab bar simply by swiping form the top of the screen, so they don't have to move the editor way off where they're editing. I was using a Windows 8 tablet for about a week, so I keep accidentally trying to do this.
    You might also suggest telling the user that they can not rename tabs to a current tab name, when they do that. I was (stupidly) trying to rename a tab, and didn't notice there was one already titled that.
    Final suggestion: Change the class template to a plain class. I mean don't add things like self.x = x, get rid of the x passed into the class, and get rid of class:touched(). I have never used those, and they are a waste of time to delete every time I create a class.
    Thanks!

  • Posts: 2,043

    I've noticed something where after letting it sit for a little bit, touching no longer works on my code, but still for the output window. Was wondering if anyone has experienced anything similar?

  • SimeonSimeon Admin Mod
    Posts: 5,416

    @Briarfox backingMode(RETAINED) works here. backingMode does not explicitly change the frame rate — there is no reason RETAINED backing mode can't draw at 60fps.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    @Simeon My bad, had a brain fart.

  • edited January 2014 Posts: 1,255

    A tiny and trivial example of fun with the location function.


    -- StaticMapExample displayMode(FULLSCREEN) function setup() loc = {} map = nil zoom = 15 fontSize(44) fill(255, 255, 255, 255) url = "http://maps.googleapis.com/maps/api/staticmap?center=" location.enable() l = vec3(location.longitude, location.latitude, location.horizontalAccuracy) table.insert(loc, l) updateMap() end function updateMap() s = url .. loc[1].y .. "," .. loc[1].x .. "&zoom=" .. zoom .. "&size=768x768" for i, l in ipairs(loc) do if l.z <= 32 then s = s .. "&markers=color:green%7Clabel:S%7C" elseif l.z <= 64 then s = s .. "&markers=color:yellow%7Clabel:S%7C" else s = s .. "&markers=color:red%7Clabel:S%7C" end s = s .. l.y .. "," .. l.x end s = s .. "&sensor=false" http.request(s, didGetImage) end function didGetImage(theImage, status, head) map = theImage end function draw() background(40, 40, 50) if map then sprite(map, WIDTH / 2, HEIGHT / 2) end text("-", 100, 80) text("+", WIDTH - 100, 80) end function touched(touch) if touch.state == BEGAN then if touch.y <= 100 then if touch.x <= WIDTH / 2 then zoom = zoom + 1 else zoom = zoom - 1 end else l = vec3(location.longitude, location.latitude, location.horizontalAccuracy) table.insert(loc, l) end updateMap() end end
  • Posts: 2,820

    @Mark - Very cool. I didn't get much time to play with it, but it looks cool.
    @John - Are there any plans for the fluid-dynamics Box2D extension in Codea v2.0?
    Thanks!

  • SimeonSimeon Admin Mod
    Posts: 5,416

    @Mark nice example of the location stuff!

    @Zoyt we don't plan to include that library in 2.0.

  • Posts: 2,161
    • The keyboard in use when in search mode is the daylight keyboard, even with the night theme, and doesn't have the special row of keys making it tricky to dismiss the search area.
    • The cursor key doesn't go beyond new lines (ie, at the end of a line pressing the cursor key on the correct side doesn't make it go to the next).
    • I find the select key somewhat unresponsive. Sometimes it doesn't work, but I've yet to narrow down the exact circumstances.
  • SimeonSimeon Admin Mod
    Posts: 5,416

    @Andrew_Stacey thanks for your feedback.

    1. The search panel is pretty broken, I plan to completely replace it (I'm not even sure if it should be a side-panel like that). I am considering removing the ability to view all functions in your project — does anyone find this useful? Secondly, do you think it's valuable to search your entire project, or would you prefer search localised to the current tab?

    2. That is intentional, would you prefer that it navigated across lines? For the tap behaviour that could make sense (though would not work for the drag behaviour).

  • Posts: 2,161

    I like being able to move the cursor beyond line boundaries. It can be hard to put the cursor at the start of a line because if you tap a bit too far left then you select the line, but it's usually easy to put it at the end of the previous line and then move one character over.

    Not sure about the search, I don't often use it.

  • IgnatzIgnatz Mod
    Posts: 5,396

    wrt Search, I use it quite a lot. I like the side panel, unless you have a better idea.

    I don't see the need to view all functions.

  • Posts: 580

    I use project searching often. I would be very sad to see it go.

  • SimeonSimeon Admin Mod
    Posts: 5,416

    @toadkick I prefer project search also — but the function list seems less used and potentially something we can replace.

  • Posts: 580

    @Simeon: agreed, the function list I have not found to be that useful.

  • Posts: 2,161

    Actually, one reason that I don't use the search so much is that with big projects then it takes ages to do something (read in all the functions? I don't know) before I can start searching. Restricting to the current tab would be much more useful to me, and would speed that up. Function list is something I can easily live without.

  • Posts: 505

    Just a free text search would be fine for me, maybe easier to make performant as well?

  • Posts: 2,820

    Since I have so many anonymous functions, the function list is useless. Just a simple find and replace would be great.
    Thanks!

  • BriarfoxBriarfox Mod
    Posts: 1,542

    +1 @zoyt If you are taking editor suggestions I'd really find collapsable functions very useful.

  • Posts: 1,255

    Collapsible functions would be darn handy.

    On search, I'd be happy if the cursor moved to the search box when I select search without my having to move it.

  • SimeonSimeon Admin Mod
    Posts: 5,416

    @Andrew_Stacey that's correct, I'll be able to speed this up using in the future (not sure if it will make it into 2.0).

    @Zoyt find and replace is on the list, unsure if replace will make 2.0.

    @Mark I will move the focus to the search box automatically.

    I'll get rid of the functions list — it's not that helpful and slows down the sidebar at the moment.

  • Posts: 2,820

    @Simeon - Thanks.
    P.S. If you didn't see on the issue tracker, I found the issue with Codea. Sorry about that, it was a user error, again.

  • dave1707dave1707 Mod
    Posts: 8,614

    @Simeon Can the "less than" and "greater than" signs be added to the popup keys. Right now you have to hit the ".?123" key then the "#+=" key to get to them. That's too many keys for as often as < and > get used.

  • dave1707dave1707 Mod
    Posts: 8,614

    @Simeon Ignore my last post on sprite(). You just have to tap on the () to show the sprite list. I'm not sure what displayMode(OVERLAY) is supposed to do. I can't get it to work like what the built in doc says.

  • dave1707dave1707 Mod
    Posts: 8,614

    @Simeon Is location supposed to be working. I called location.enable() in setup and tried the other functions, but I'm not getting anything. Should something be set on the iPad.

  • dave1707dave1707 Mod
    edited February 2014 Posts: 8,614

    @Simeon pasteboard seems to work OK. Haven't tried music. Not sure where to get music to play from.

  • Posts: 2,820

    @dave1707 - I assume you approved Codea to use your location? Settings>Privacy>Location, to make sure.
    @Simeon - Do you have an ETA on when we can access the new runtime, if we get it before release at all?
    Thanks!

  • dave1707dave1707 Mod
    Posts: 8,614

    @Zoyt Yes I turned it on, but when I went back to check again, it was off. I turned it back on and made sure it stayed on. Tried some location code and it looks OK.

Sign In or Register to comment.