SA-MP Forums Archive
[Include] progress3D - Create progress bars in 3D space - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] progress3D - Create progress bars in 3D space (/showthread.php?tid=658380)



progress3D - Create progress bars in 3D space - Manyula - 03.09.2018

progress3D.inc



After the 2D textdraw-based version of progress bars, here now comes the 3D version. This library lets you create progress bars in 3D space. It's basically just two overlapping 3D text labels, one being moved slightly to the right to fill in those gaps between the characters. Have fun with it!

Repository



Functions
Changelog

v2.0 v1.3.1 v1.3 v1.2.1 v1.2 v1.1 v1.0


Re: progress3D - Create progress bars in 3D space - Pottus - 03.09.2018

Код:
static Bar3D:Bars3D[MAX_3D_BARS][BAR_3D_DATA],
       Text3D:Bars1[MAX_3D_BARS],
       Text3D:Bars2[MAX_3D_BARS];

new Iterator:Bars3D_Index<MAX_3D_BARS>,
    Iterator:Bars1_Index<MAX_3D_BARS>,
    Iterator:Bars2_Index<MAX_3D_BARS>;
Create one iterator, one variable and one enum instead of this disaster.


Re: progress3D - Create progress bars in 3D space - Alteh - 03.09.2018

It looks interesting but it improves the code please.

Good release


Re: progress3D - Create progress bars in 3D space - Kemula - 03.09.2018

I'm taking this!

Nice work.


Re: progress3D - Create progress bars in 3D space - Manyula - 03.09.2018

First of all, thank you for the constructive feedback!

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Another thing I noticed was a lot of copy-paste code, bar1/bar2 could be globally allocated as `static const` to remove the need to allocate on the stack. And the code that calculates and manipulates the label text could be delegated to a separate function because currently it's copied into three places, if you had to fix a bug you'd have to fix it three times, which increases the chances of typos introducing more bugs!

Aside from that, the code is pretty good. There might be some string manipulation optimisations to be done but it's probably unnecessary. Good work!
In the first pass, I usually prioritize functional over optimized code - the latter is something I bother about in the second pass, so delegating the progress calculation to a separate function is definitely something I'll do, thanks!

About the stack allocation: So, you're saying that I should just do this?
PHP код:
static const bar1[] = "IIIIIIIIIIIIIIIIIIIIIIIII",
             
bar2[] = " IIIIIIIIIIIIIIIIIIIIIIIII"



Re: progress3D - Create progress bars in 3D space - KinderClans - 03.09.2018

So if for example i have a timer of 20 seconds, how i can set the progress bar to fill completely in 20 seconds?


Re: progress3D - Create progress bars in 3D space - Manyula - 03.09.2018

For now, the progress is calculated in percent, so 0.0 is the minimum and 100.0 is the maximum value.
So, if 20 seconds are 100%, then 1 seconds equals 100/20 = 5%. So, each second, you would have to increase the value by 5.0.

I realize, this might be a bit inconvenient to use. I might add "min_value" and "max_value" parameters and let the function do the calculations for you in the near future.


Re: progress3D - Create progress bars in 3D space - SyS - 03.09.2018

Nice release.


Re: progress3D - Create progress bars in 3D space - coool - 03.09.2018

Good release


Re: progress3D - Create progress bars in 3D space - Manyula - 06.09.2018

Quote:
Originally Posted by Manyula
Посмотреть сообщение
For now, the progress is calculated in percent, so 0.0 is the minimum and 100.0 is the maximum value.
I've now added a 'max_value' parameter and three new layout options for bar thickness. Thanks for the feedback!


Re: progress3D - Create progress bars in 3D space - Unrea1 - 28.09.2018

I don't see the download link...


Re: progress3D - Create progress bars in 3D space - CantBeJohn - 28.09.2018

Quote:
Originally Posted by Unrea1
Посмотреть сообщение
I don't see the download link...
https://github.com/TheManyula/progress3D/releases

(It's currently missing from the main post for some reason)


Re: progress3D - Create progress bars in 3D space - tonmgdamamg3 - 22.01.2019

Please update this for support streamer plugin v2.9.4, i've found many error for streamer v.2.9.4


Re: progress3D - Create progress bars in 3D space - RenanMsV - 22.01.2019

The test pwn is just crashing my pawncc. cant compile it :B 0.3.7


Re: progress3D - Create progress bars in 3D space - Manyula - 23.01.2019

Quote:
Originally Posted by tonmgdamamg3
Посмотреть сообщение
Please update this for support streamer plugin v2.9.4, i've found many error for streamer v.2.9.4
The errors are caused by the 2.9.4 version of the streamer plugin.

EDIT: The issue was a tag that got removed in the new streamer version. progress3D version 2.0 is now compatible with streamer version 2.9.4.

Quote:
Originally Posted by RenanMsV
Посмотреть сообщение
The test pwn is just crashing my pawncc. cant compile it :B 0.3.7
Are you using sampctl? Which compiler version are you using?


Re: progress3D - Create progress bars in 3D space - Kar - 23.01.2019

Awesome, no border?


Re: progress3D - Create progress bars in 3D space - Manyula - 24.01.2019

Quote:
Originally Posted by Kar
Посмотреть сообщение
Awesome, no border?
Unfortunately no border. Adding outlines to the characters themselves also adds their outlines to the center of the progress bar.
In order to add a border that only surrounds the bar would require four entirely black bars covering all four edges, so eight additional 3D text labels. I don't think that's worth it.
Quite some time ago, I suggested adding variable font sizes and letter spacing to 3D text labels which would drastically reduce the amount of labels required. Since that hasn't happened, there's nothing I can do.