Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Text to Sprite for better "Buttons"

Author
Message
JasonPC
9
Years of Service
User Offline
Joined: 14th Apr 2015
Location: United Kingdom
Posted: 30th Apr 2015 13:44
Hi there,
I've been looking at the Button features of AppGameKit and realise I want a bit more flexibility (gradients/texture and possibly multi-line).
My idea is to render the text to a spite and use the built-in collision detection to simplify the code.


I've got the text into a sprite, but I'm having problems adding a background to the text.

The attached screenshot shows what I'm currently getting from the code below.





[img]null[/img]
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st May 2015 00:38
If you want really nice buttons use images and change the image depending on the button state. That way you will have much crisper, more professional looking gfx.

Using AppGameKit V2 Tier 1
JasonPC
9
Years of Service
User Offline
Joined: 14th Apr 2015
Location: United Kingdom
Posted: 1st May 2015 23:12
Yeah, an image is easy to code (but then needs time to create outside of AGK), but I'm really looking for some basic Widgets - the current "button" code is not that flexible.

I'm happy to code a function to pre-render images (sprites), using a font pack and options for background texture/gradient/solid would work very well.
This is for apps, not in-game.


But, it looks like my screenshot didn't come through.
I've got the text "JASONS", and there should be a yellow>black gradient box UNDER the text. However, it's over the text (so obscuring "JA")

Do I need to create an image from the text, it looks like I need to look at the rendering pipeline.
The text and the colour (combined) do appear on the created sprite, but it looks like the Depth/Z order is not as expected and the text is below the Box (even if it is created after)
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 2nd May 2015 14:41 Edited at: 2nd May 2015 14:45
Oh, any of the draw commands are drawn above everything except the print function. It's all in the description.

http://www.appgamekit.com/documentation/Reference/Core/DrawBox.htm

Also, I made these functions to serve as a quick testing of menus and stuff.

Login to post a reply

Server time is: 2024-11-23 10:34:34
Your offset time is: 2024-11-23 10:34:34