Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Two overlapping buttons with transparent images  (Read 5109 times)

0 Members and 1 Guest are viewing this topic.

Mihulik

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 71
    • View Profile
Two overlapping buttons with transparent images
« on: August 09, 2010, 01:38:05 PM »

Hi,
I've been trying to figure out this problem for a few hours but I haven't been successful yet...

I have a menu that contains a irregular graphic and two buttons lies in the graphic.


Each of those buttons is represented by a transparent image.
However, because button entity is represented by a rectangular area I can't approximate shape of the images.

I need to do something when player clicks on one of those buttons. However, when I try to click on the overlapping area, the button that has higher z-order receives the event even if I've clicked on the image of the opposite button.

I've tried to set the "PixelPrecise" property of the buttons on true but it didn't change anything.

Is there any convention way how to handle it in WME?


I know my description of the problem is a little confusing but I believe the image I've attached with the post is more descriptive :)
« Last Edit: August 09, 2010, 01:39:49 PM by Mihulik »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Two overlapping buttons with transparent images
« Reply #1 on: August 09, 2010, 02:24:04 PM »

I've tried to set the "PixelPrecise" property of the buttons on true but it didn't change anything.
It didn't? It should. That property is exactly for what you describe.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mihulik

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 71
    • View Profile
Re: Two overlapping buttons with transparent images
« Reply #2 on: August 09, 2010, 02:35:57 PM »

I've tried to set the "PixelPrecise" property of the buttons on true but it didn't change anything.
It didn't? It should. That property is exactly for what you describe.
It did not...Should I set something in the parent window? I've checked my images but they're really transparent (PNG files) ???
Logged

Mihulik

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 71
    • View Profile
Re: Two overlapping buttons with transparent images
« Reply #3 on: August 09, 2010, 02:45:45 PM »

This is a definition of the window:

Code: [Select]
; generated by WindowEdit

; $EDITOR_PROJECT_ROOT_DIR$ ..\..\..\

WINDOW
{
  NAME="music_interface"
  CAPTION=""
 
  IMAGE="interface\music interface\images\interface-background.jpg"
  FONT="fonts\outline_white.font"
 
  TITLE="Music interface"
  TITLE_ALIGN="left"
 
  X=0
  Y=0
  WIDTH=1024
  HEIGHT=768
  DISABLED=TRUE
  VISIBLE=TRUE
  PARENT_NOTIFY=FALSE
  TRANSPARENT=FALSE
  PAUSE_MUSIC=TRUE
  MENU=FALSE
  IN_GAME=TRUE
  CLIP_CONTENTS=FALSE
 
  ALPHA_COLOR { 0, 0, 0 }
  ALPHA=0
 
  SCRIPT="interface\music interface\music_interface.script"
 
  EDITOR_PROPERTY
  {
    NAME="Selected"
    VALUE="False"
  }

  BUTTON
  {
    NAME="ring1"
    CAPTION=""
   
    IMAGE_PRESS="interface\music interface\images\interface_staffring1_mouseclick.png"
   
    TEXT=""
    TEXT_ALIGN="center"
   
    X=490
    Y=610
    WIDTH=60
    HEIGHT=90
    DISABLED=FALSE
    VISIBLE=TRUE
    PARENT_NOTIFY=FALSE
    FOCUSABLE=FALSE
    CENTER_IMAGE=TRUE
    PRESSED=FALSE
    PIXEL_PERFECT=TRUE
   
    SCRIPT="interface\music interface\ring.script"
   
    EDITOR_PROPERTY
    {
      NAME="Selected"
      VALUE="False"
    }

  }
  BUTTON
  {
    NAME="ring2"
    CAPTION=""
   
    IMAGE_PRESS="interface\music interface\images\interface_staffring2_mouseclick.png"
   
    TEXT=""
    TEXT_ALIGN="center"
   
    X=533
    Y=612
    WIDTH=40
    HEIGHT=75
    DISABLED=FALSE
    VISIBLE=TRUE
    PARENT_NOTIFY=FALSE
    FOCUSABLE=FALSE
    CENTER_IMAGE=TRUE
    PRESSED=FALSE
    PIXEL_PERFECT=TRUE
   
    SCRIPT="interface\music interface\ring.script"
   
    EDITOR_PROPERTY
    {
      NAME="Selected"
      VALUE="True"
    }

  }
}

Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Two overlapping buttons with transparent images
« Reply #4 on: August 09, 2010, 02:57:43 PM »

These buttons only have the "pressed" image assigned, no normal image. That will be the problem, I think.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mihulik

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 71
    • View Profile
Re: Two overlapping buttons with transparent images
« Reply #5 on: August 09, 2010, 03:07:19 PM »

I'll try it...
Logged

Mihulik

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 71
    • View Profile
Re: Two overlapping buttons with transparent images
« Reply #6 on: August 09, 2010, 06:26:13 PM »

You're right. It was the problem.
Thank you :)
Logged
 

Page created in 0.042 seconds with 23 queries.