Announcement

Collapse
No announcement yet.

A thought - multiple DAT entries for one image?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • A thought - multiple DAT entries for one image?

    I just realized that if I want 26 keys using the img_Touched methods then I'll need 52 images (26 up, 26 down). I figure the img_SetPosition() coordinates and image size are used to calculate if a particular image is hit rather than the actual image so if I use one image and basically 'paste' it down in multiple spots then only the last spot would be reported by img_Touched().

    However, since the images are blitted from disk that makes me think I can just manually edit the .DAT file and make 25 extra copies each of the two image entries. That way there are only two images but 52 distinct entries in the image list. The image list would just have 26 identical pointers to each of the two key images.

    Now I'm not saying this is the most efficient way of displaying and using a keyboard only that this could be possible. With 2 gigs of storage and no RAM use by the images themselves I can afford to have 52 different keys with captions already in place - the 'big' gci file will still be tiny compared to the space available.

  • #2


    Tried it out and it works just fine. I made two button images, one up and one down, and edited the DAT file to have 26 copies of each button. I use the img_* functions to place 26 "up" buttons on screen and they report as 0-25 when touched.

    I placed all the UP and DOWN button images at the same time and drew the "down" versions first then the "up" versions over top. When an image is touched I simply img_Show(iHandle,iTouched+26); and it shows the button being hit. On release I do an img_Show(iHandle,iTouched); and it restores the up version.

    I had thought that on release I'd get the "down" version of the button reporting as being hit since it was on top but it doesn't seem to do that. I guess the img_Touched() value only changes on a PRESS event, not release.

    Now I'll go make all the different buttons as seperate files with their letters etc. Figure it's a lot easier than trying to draw fonts on top of each button in the right spot etc.

    Comment

    Working...
    X