keyboard control x position glyph/font

ampersandy's picture

any ideas about how to organise the order of a series of images across the screen. what i want to do is via keyboard input position a glyph in the right order. so if i type an "a" the image for a is enabled and displayed at say x=0, then i type a b and the image for b is enabled and displayed at say x=0+1, and so on. this has to work in any order so i can type q, u, a, r, t, z or t, a and the individual images will appear in the right position (and stay there). i have tried using the sample and hold patch and the counter/math but it ends up with all glyph/images moving, i need to be able to insert/enable a glyph in one position then have it stay there and the next glyph appear beside it. to spell/create a word.

please help... it is driving me crazy?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

fsk's picture
Re: keyboard control x position glyph/font

three basic examples of this

PreviewAttachmentSize
type example.qtz12.91 KB

ampersandy's picture
Re: keyboard control x position glyph/font

hi fsk that is really neat, thank you ; )

but

what i am attempting is to generate a completely new font...

so it is not using existing fonts at all but e.g. key input "a" will enable glyph made of lots of cubes all inside a trackball patch...

different key inputs enable different trackballs, iam ok up to here.. but i need a method to get them to be given a postion in space so that they come out just like the neat example you posted!

so i think i need a different approach ?

any ideas? please! thanks!!!

smokris's picture
Re: keyboard control x position glyph/font

@fsk's composition is still a good place to start (nice use of the Feedback patch, by the way!).

Once you have a string representing the characters you want to render, feed that into an iterator. Iterate once for each character you'd like to draw, and then, inside the iterator, use a series of conditionals to enable the appropriate macro patch for the letter.

ampersandy's picture
Re: keyboard control x position glyph/font

hi smokris and fsk

you are so helpful its great... thank you... i am relative newcomer to this and have uploaded the compostion (with three letters a,b,c) so you can see exactly what is going wrong...

if you can give some specific ideas about the conditionals i need to insert (and how to do it) that would be fantastic!

thanks

ampersandy

PreviewAttachmentSize
glyph_example_00.qtz56.96 KB

smokris's picture
Re: keyboard control x position glyph/font

You have Structure Index Member connected directly to the Enable input of the three letter macros. There's a type conversion going on here --- a string is being converted into a boolean. Any non-null string is treated as a boolean True value, and since "a", "b", and "c" are all non-null strings, all three letters display in each position.

Use a String Compare patch for each macro's Enable input, to see if this particular iteration's character matches the character the macro is intended to display. Be careful about the output of String Compare --- it returns zero when there is an exact match, so you'll need to use a Conditional to invert the logic signal.

A cleaner alternative might be to modify your root-level Javascript to output an integer for each character, then, inside the Iterator, feed that integer value to a Boolean Demultiplexer with "Use Reset Value" set to True.

ampersandy's picture
Re: keyboard control x position glyph/font

you are brilliant!!! but how do i go about making the conditional? or how do i modify the java script as you suggested... thanks ; )

ampersandy's picture
Re: keyboard control x position glyph/font

brilliant... smokris & fsk

this seems to work... but only partially...
but the macros lose their audio interactivity! if you type the same character e.g. a,a,a, it all works fine! 
 but if you type different characters e.g. a,b,c they appear in the right order but do not respond to audio and also lose the trackball 3d rotation

any ideas?

thanks

PreviewAttachmentSize
glyph_example_3.qtz57.59 KB