Re: cairo: multiple sprites images in one PNG

2012-03-16 Thread Lucas Levrel

Le 15 mars 2012, Christopher Howard a écrit :


Question for the veterans:

--
ship_surf = cairo_image_surface_create_from_png(ship.png);
// ...
cairo_set_source_surface (cr, ship_surf, x, y);
cairo_paint (cr);
--

But what if I want, for ease of maintainability (and less system I/O
calls) to put a whole bunch of sprites in one PNG? Is it possible for me
to either...

* load one PNG image into a surface, and then draw to a CR using only a
small part of that surface?

or

* load one PNG into a surface, and then split that surface into multiple
smaller surfaces?


I'm no veteran, but I'd create one small cairo_t per sprite, then repeat 
your last two lines above (where cr would be the sprite), once for each 
sprite, with appropriate x and y : Cairo will automatically clip what 
falls outside the sprite's cairo_t.


(Your first option seems feasible with clipping, but might be more 
complicated: you'd need to clip each time you draw the sprite.)


--
Lucas Levrel
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


how to i set hscale wigdet to -- say -- 17?

2012-03-16 Thread Gary Kline

thanks to  a great amount of help from this list , my let the
computer speak for the speech-impaired [AKA VBC] is making good
progress.  in fact, my Options pop-up from the menubar is almost 
ready for integration.  but i still  want it to look like the 
program 'gespeaker'---meaning that i want to set, say, Pitch to
17, Speed to 100, Speed in words/minute to a nice, slow 190. and 
the Delay in 10ths of a second between words to 2 or 3.  

i have experimented with people who suffer from a hearing loss and
some whose native language is not English, c.   so: better to
default to a slower rate.  i want to know how to have gtk draw that
orange line from 0  to  my default starting point. gespeaker
presents a good example.  i haven't found the magic google  term[s]
to  find what gtk command i need.  can any of you help?

thanks in advance,

gary

-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
 Voice By Computer (for Universal Access): http:/www.thought.org/vbc
  The 8.57a release of Jottings: http://jottings.thought.org
 Twenty-five years of service to the Unix community.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


key press events holding keys down

2012-03-16 Thread Christopher Howard
Hey guys -- thanks again for the help I received recently regarding
several noobie issues. I'm still working on my space combat game, and
came across this little problem:

I control the spacecraft with the arrow keys, which I do by grabbing the
GdkEventKey and then checking it against GDK_KEY_Left, GDK_KEY_Right,
and so forth. Strictly speaking what I am concerned with is whether or
not the key is held down, but this seems to work because the key event
gets repeated.

However, if one of the arrows is held down, and another arrow is
pressed, then it shuts off events for the first arrow. That's bad, of
course, because in my game the player may want to hold down two arrows
keys at once (e.g., UP for acceleration and LEFT to turn the
spacecraft). So...

* are there configuration settings I need to adjust to change how these
GdKEventKeys are generated?

or

* is there some totally different method of checking and handling key
depression state that I should be using?

-- 
frigidcode.com
indicium.us

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list