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.

Code Snippets / [DBC/DBP] Circular Statistic Bar

Author
Message
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Sep 2007 21:12 Edited at: 11th Sep 2007 19:16
Are you bored of using straight bars for your characters' statistics (health etc). Using these two functions you can make circular statistic bars and whatever else you want.
My DLine function is more precise than the DB Line command and using it along with my rounding function it will produce smooth lines and curves.

[edit]

Here's a new version, I've replaced the rounding function with my new one and added a wait before sync'ing; does that help DBP users?



You can now see how long DLine Real takes to draw.

In programming, nothing exists
Pyramid Games Ltd
16
Years of Service
User Offline
Joined: 23rd Aug 2007
Location: Line 21, DBP
Posted: 9th Sep 2007 22:28
Will you ever stop posting here? Doesn't work for me.

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 9th Sep 2007 22:42
Wont work in DBP because of the @s, but it works fine in DBC.

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 10th Sep 2007 13:16
Quote: "Will you ever stop posting here? Doesn't work for me."

What's wrong with me posting here!?
This is something I wanted to do for a while so I thought there would be others that would find this useful.

Quote: "Wont work in DBP because of the @s, but it works fine in DBC."

Oh, I was using "~" before but that caused errors in DBP too. What symbol can I use for functions without it causing an error in DBP?

In programming, nothing exists
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 10th Sep 2007 18:03
Dont think you can use any symbols.

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Mr Kohlenstoff
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 10th Sep 2007 19:16
The only symbol I know would be the "_", apart from that just letters and numbers. But even if I replace all the @s with _, the program doesn't work in DBP, because you need one more sync.

-> DBP-Code:



But I'm pretty sure that the function won't be usable in realtime, because you are using the dot-command, which is much to slow... maybe it would be better, to use memblocks instead.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 10th Sep 2007 22:52
Thanks MK, you're probably right about the dot thing, it's OK for drawing 1 or 2 lines but for this it slows down badly.
How would I do it with a memblock though?

In programming, nothing exists
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 11th Sep 2007 17:35
Use the box command to make a dot.

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 11th Sep 2007 18:50 Edited at: 11th Sep 2007 19:17
I tried the box but it didn't make any difference or did you mean use it with memblock?
Would drawing off-screen help speed it up?

[edit]
I've changed the program a little, does that help with the sync problem?

In programming, nothing exists
Mr Kohlenstoff
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 11th Sep 2007 22:33
When you use lock/unlock pixels the dot-command is much faster than the box-command. Otherwise they seem to have the same speed on my pc.

@OBese87: With memblocks you can directly write pixel-data to the memory, so you don't have to draw it to the screen with 2D-Commands. After creating the memblock you can convert it to an image which can be pasted to the screen then, what is much faster.

Atreides
20
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 11th Sep 2007 23:14
@OBese87 and Mr Kohlenstoff:
You can also get the pointer of your screen and copy the data of the memblock directly on the screen. It may be faster than making an image and then pasting it.
Look at :


The sleeper must awaken !
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Sep 2007 00:01
I can't lock pixels, I only have DBC.
Thanks for the rest

In programming, nothing exists
Mr Kohlenstoff
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 12th Sep 2007 16:27 Edited at: 13th Sep 2007 12:32
Quote: " I can't lock pixels, I only have DBC."


OK, sorry, didn't know.


Quote: " @OBese87 and Mr Kohlenstoff:
You can also get the pointer of your screen and copy the data of the memblock directly on the screen. It may be faster than making an image and then pasting it."


I never worked with this commands and never really understood pointers (in fact I never even tried to..), but maybe it would be a good idea. But it's possible to change images with a size of for instance 512*512 pixels in realtime with still 20 FPS, so the process of making an image out of a memblock needs nearly no time. However, thanks for the information, will think about it.


Edit: I made a function creating such a healthbar using memblocks.

The function itself looks like this:



It uses other functions because it's part of an image-editing function library, thread here:
http://forum.thegamecreators.com/?m=forum_view&t=114123&b=1&p=0

Login to post a reply

Server time is: 2024-05-08 02:40:09
Your offset time is: 2024-05-08 02:40:09