Gamestudio Links
Zorro Links
Newest Posts
Why Zorro supports up to 72 cores?
by 11honza11. 04/26/24 08:55
M1 Oversampling
by 11honza11. 04/26/24 08:32
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (VoroneTZ, Quad, EternallyCurious, 1 invisible), 840 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How is to create indicator changing according to user value? #479111
02/19/20 14:03
02/19/20 14:03
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Hello,
How can I make the indicator (needle) that has a value of 50 at the beginning, and ranges between 0 and 100 according to user ratings in the video?

The video example link is here: https://we.tl/t-z3DX5YiCTB

Thank you,

Re: How is to create indicator changing according to user value? [Re: gamers] #479115
02/19/20 14:54
02/19/20 14:54
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
You can use needle for that.

Here is an example:
[Linked Image]

Code:
Code
#include <acknex.h>
#include <default.c>

#define PRAGMA_POINTER

FONT *main_text_font = "Courier#64";

var credibility = 50;

BMAP *needle_png = "needle.png";
BMAP *range_png = "range.png";

PANEL *needle_pan = 
{
	scale_x = 4;
	scale_y = 4;
	digits(0, -48, "CREDIBILITY", main_text_font, 0, 0);
	needle(0, 0, needle_png, 30, 1, 0, 200, 0, credibility);
	flags = SHOW | CENTER_X | CENTER_Y;
}

PANEL *range_pan = 
{
	scale_x = 6;
	scale_y = 6;
	bmap = range_png;
	flags = SHOW;
}

void main()
{
	warn_level = 6;
	fps_max = 60;
	
	pan_setcolor(needle_pan, 1, 1, COLOR_GREY);
	
	while(!key_esc)
	{
		needle_pan->pos_x = screen_size.x / 2;
		needle_pan->pos_y = (screen_size.y / 2) + 96;
		
		range_pan->pos_x = needle_pan->pos_x - ((bmap_width(range_pan->bmap) * range_pan->scale_x)  / 2);
		range_pan->pos_y = needle_pan->pos_y - ((bmap_width(range_pan->bmap) * range_pan->scale_y)  / 2);
		
		DEBUG_VAR(credibility, 0);
		credibility -= 5 * (key_a - key_d) * time_step;
		credibility = clamp(credibility, 0, 100);
		wait(1);
	}
}


Images used:
[Linked Image]

[Linked Image]

Best regards!

Last edited by 3run; 02/19/20 14:55.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: How is to create indicator changing according to user value? [Re: 3run] #479116
02/19/20 15:25
02/19/20 15:25
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Fantastic! Thank you so much 3run.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1