123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|114|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Mini Challenges -> Write : Buttons

Fri, 09 Oct 2009, 07:55
Jayenkai
Create a neat looking scalable button function that can be reused in lots of place, using only code.

----

The Write Rhyme

Print text and draw boxes, draw circles and lines.
Use things that within your language you'd find.
If you need a package for painting to do it,
You haven't quite managed to keep in the spirit.

-=-=-
''Load, Next List!''
Wed, 14 Oct 2009, 04:00
Jayenkai
Rather blocky Retro!



-=-=-
''Load, Next List!''
Sat, 17 Oct 2009, 06:13
CodersRule
Jay, is there a way to make those buttons functional? That'd be cool

isPushed=Button(x,y,"Lala","lala2")
It would draw the button and return a value
Sat, 17 Oct 2009, 06:51
Jayenkai
Yes, it returns out..
So if button(x,y,"TADA")=1 then the mouse is over it, and if =2 then it's clicked..

Forgot to shove that example in there, but it works!

-=-=-
''Load, Next List!''
Mon, 19 Oct 2009, 05:00
CodersRule
Ah cool
EDIT
--
Lame example ftw. (This is of Jay's)

Mon, 19 Oct 2009, 21:53
Cower
Mine doesn't do the whole pressed/unpressed result thing (although it'd be easy to put that in there either as a callback, event, or just a result of "If button.Pressed() Then" sort of method. However, all I got out of the initial post was that it was visual, so I made something visual.

Also, it's a type, not a function. This doesn't really change much in terms of how things work.

Anyhow, code- requires BlitzMax and a healthy lack of sanity:


Edit: Updated code, may have severely gimped it, I'm not entirely sure. It's prettier, at least.

And a video of it:

View on YouTube
Wed, 21 Oct 2009, 02:22
LostUser
Here is my button library.

The button themes aren't very nice looking though (for some reason using FatBox makes the thing very slow).

Requirements: fatbox functions (follows code)