Found a couple of possible bugs with parameters -
iparameter ignores negative values - there are no errors when using them in code but the slider still starts at 0.
When parameters are updated in code the sliders are not updated (maybe I need to do something when setting them?).
Really enjoying the app though, thank you.
Andy – good point about the sliders not being updated. That’s something I thought about: but what if you are dragging them while they are being updated, what would be the desired behaviour?
Perhaps I can update the value of the number next to the slider, but leave the position for the user to set.
Thanks for bringing this up, let me know your thoughts.
I hadn’t thought of that as for what I’m doing at the moment it doesn’t really make sense to be doing both at once (sliders to set graph axes and tap on screen to reset to default).
I think the behaviour I would want normally is if the slider is actually being touched then drop any updates made in code but if the slider is inactive then set value and position according to the value set in code.
Also, any plans to allow for drawing text? I’ve written code to draw numbers manually but I’m sure its not very efficient compared to what can be done with a built-in method…
Definitely plans to draw text. The thought at the moment is a simple API as follows:
size = textSize( “string” ) – returns text dimensions as a vec2
text( “string”, x, y )
One font. Not sure if a fontSize() should be included when scale(x,y) can simply be used instead.
textSize(size) – sets the font size
textWidth / textHeight get the string dimensions
Sounds good, doesn’t need to be anything fancy. My preference would be -
textFontSize(size) - Set the font size
textSize( “string” ) - Get dimensions of string (possibly with optional size parameter for more concise code if you need to check text will fit etc.)
text( “string”, x, y ) - Draw the string
I think this sort of API will come first.
A future API update could overload text() to accept text(“string”, x, y, width) and textAlign( CENTER | LEFT | RIGHT ).
Text would then wrap with the width and height parameters specified. textSize(“string”, width) would return the wrapped text’s size.
Or a simpler function for text alignment:
- textAlign(LEFT|RIGHT|CENTER|JUSTIFY, TOP|MIDDLE|BOTTOM)
If arbitrary font face becomes a problem, font face can be provided as constant, like this:
- fontStyle(ROMAN|SERIF|FIXED, size, REGULAR|BOLD|ITALIC|UNDERLINE)
With ROMAN font face using Times New Roman or Georgia, SERIF font face using Arial or Tahoma, and FIXED font face using Courier New or Codea editor’s font. I think 3 options are enough.