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.

AppGameKit Classic Chat / Slide bar input

Author
Message
Mermaja
8
Years of Service
User Offline
Joined: 28th May 2015
Location: Vistabella del Maestrazgo, SPAIN
Posted: 25th Nov 2015 17:50
Hello.

I am not sure if this is the correct forum to post this, but I have developed a slider bar input system, and I want to share it with AppGameKit Tier 1 programmers. I attach the image of a simple demo, which uses three sliders to change the R, G and B components of a color, and shows the result in corresponding
rectangles -one for each component and the bigger one for the color.

I post also the source code of the demo to show the ease of use of the functions. Please inform me if you find it useful and the best place to post the complete source code.

Regards,
Germán.

Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 25th Nov 2015 21:35
Nice work!

You could post all the code in the Code Snippets or just in another thread, whatever works best for you.

Some things to maybe add...

Have it calculate the actual color value, as in MakeColor(red, green, blue).

Have it output a text file with the MakeColor() command already constructed!
You could then open the text file with the OpenBrowser() command and the user could just copy/paste the command. (to bad there's no "copy to buffer" command in AGK2 Tier 1)

Have it display the hexadecimal color values (handy for web pages).

Add a slider for transparency, with a checkerboard background behind the color displayed.

I played around with similar code here
Mermaja
8
Years of Service
User Offline
Joined: 28th May 2015
Location: Vistabella del Maestrazgo, SPAIN
Posted: 26th Nov 2015 06:44 Edited at: 27th Nov 2015 06:17
Thank you for your advises.

Please note that my code is focused on the sliders part of the program, the main application is just a demo. Nevertheless I appreciate your comments, thank you

I attach below as snipet the complete set of functions for the small sliders library. Feel free to comment or ask any question. And of course of using the code.

Regards.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 26th Nov 2015 08:48
If you want to put all colours in one slider, here is the code to convert the position to a colour. There might be a more efficient way, but this is what I came up with after a long coding sessions a few months ago.
ret# is a value between 1 and 100.
c is an array with 3 integers for red, green and blue.



To make this more useful, you can then add a lightness slider. This is also a value between 0 and 100. At 0, any colour will be black. At 100, any colour will be white. 50 is the "pure" colour.



Images attached, you should be able to use this with the code posted by mermaja very easily.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Attachments

Login to view attachments
Mermaja
8
Years of Service
User Offline
Joined: 28th May 2015
Location: Vistabella del Maestrazgo, SPAIN
Posted: 26th Nov 2015 09:06 Edited at: 26th Nov 2015 16:15
Hello.

I finally post the new screenshoot and the new main code after applying many of the suggestions form Rich. Thank you very much!


Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-26 15:05:07
Your offset time is: 2024-04-26 15:05:07