about summary refs log tree commit diff stats
path: root/client.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-17 10:00:59 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-17 10:00:59 +0200
commitee5ba1443142e8e8e69933874eaa5415dbb8d80d (patch)
tree4bfe89146b4c1d7fac7b8e5e582421d43144e7de /client.c
parentb706893e0aadf5e9141b52d09e9ca12b261739f1 (diff)
downloaddwm-ee5ba1443142e8e8e69933874eaa5415dbb8d80d.tar.gz
Added tag 0.2 for changeset 0a6472e2203994bc5738d40a340d26f7ec9d6062
Diffstat (limited to 'client.c')
0 files changed, 0 insertions, 0 deletions
th text' href='/akkartik/text.love/commit/button.lua?id=475bbd70efec08f4279f42b044dfe3bb9f35d63e'>475bbd7 ^
6e152a9 ^
475bbd7 ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

                                
                    





                                                                            
                                       


                                
                                                         
                                        
                                                             
                                                                 


       
-- simple immediate-mode buttons

Button_handlers = {}

-- draw button and queue up event handlers
function button(name, params)
  love.graphics.setColor(params.color[1], params.color[2], params.color[3])
  love.graphics.rectangle('fill', params.x,params.y, params.w,params.h, 5,5)
  if params.icon then params.icon(params.x, params.y) end
  table.insert(Button_handlers, params)
end

-- process button event handlers
function propagate_to_button_handlers(x, y, mouse_button)
  for _,ev in ipairs(Button_handlers) do
    if x>ev.x and x<ev.x+ev.w and y>ev.y and y<ev.y+ev.h then
      if ev.onpress1 and mouse_button == 1 then ev.onpress1() end
    end
  end
end