tincxd

Button gradient with color

Recommended Posts

I'm creating a button with a gradient,

image.png.562456912b712b28208a7ce4b589bb49.png

Iv done this by using "gradient_fadein", but i want the gradient to start at bottom, is it possible to rotate it somehow?

I'v tried "gradient_bottom", but its black so it doesn't color blue...is it possible to recolor it?

image.png.9a6962350d679e6e9ce64806f16835b4.png

The upper picture shows "gradient_bottom".

Code:

itemDef \
{ \
	visible			visArg \
	name			"button_default"id \
	rect			(x+90) y w h X_BUTTON_ALIGN \
	style			WINDOW_STYLE_SHADER \
	background		"gradient_bottom" \
	forecolor		0 0.45 0.85 0.5 \
} \

Any help is welcome :)

 

Share this post


Link to post
Share on other sites

"background" is name of material.

Create 2d material with color of your choice and use it in "background" property.

  • Like 1

Share this post


Link to post
Share on other sites
23 minutes ago, T-Max said:

"background" is name of material.

Create 2d material with color of your choice and use it in "background" property.

Will do that, seems like the fastest way.

What is the difference between a material and a shader? I mean, is "gradient_bottom" a shader or a material?

Share this post


Link to post
Share on other sites
Posted (edited)

Shader style means game will draw materials instead of texts. It's not fastest, it's the only way.

You can't draw shader because shader is a subprogram for GPU. "style" property equals to WINDOW_STYLE_SHADER just means game must get materials from few other properties and draw it in specified rect.

Edited by T-Max

Share this post


Link to post
Share on other sites

Thank you for help and explanation :).

Managed to do it with a new material.

image.png.e50f0c76bca39f20c42f7067549cfa34.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.