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.

Program Announcements / Advanced2D

Author
Message
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 14th Jul 2011 13:06
It means you set the resolution higher than the resolution of the screen.

Try using "set display mode desktop width(), desktop height(), 32".

[b]
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Jul 2011 13:31 Edited at: 14th Jul 2011 13:33
From the second line of my code:


EDIT: Could it be the "display width()" / height are not as they appear?

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 14th Jul 2011 15:42 Edited at: 14th Jul 2011 15:44
I don't think that would work if the program starts in fullscreen mode. Try it with desktop width()/desktop height() instead and see if that helps. Also make sure the taskbar isn't visible as that would shrink the visible area.

[b]
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Jul 2011 15:55
Quote: "I don't think that would work if the program starts in fullscreen mode."

I was starting in fulldesktop.

Quote: "Try it with desktop width()/desktop height() instead and see if that helps."

I'll do that, thanks!

Quote: "Also make sure the taskbar isn't visible as that would shrink the visible area."

This is not visible in fulldesktop mode.

I'll experiment and let you know what the solution is.

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 15th Jul 2011 18:00
I'm almost done putting together a help file for Advanced 2D, but I have no idea what a2SetBlendMode is used for. Does anyone have an example of how to use this?

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 15th Jul 2011 18:26 Edited at: 15th Jul 2011 18:26
It controls how colours are blended together.

Source = colour of pixel being drawn
Dest = colour of destination pixel
Result = colour of resultant pixel

Result = Source*SourceBlend [op] Dest*DestBlend

[op] can be add, subtract, reverse subtract, minimum or maximum.

SourceBlend and DestBlend can be any of these.

By default the blending equation is:
Result = Source*SourceAlpha + Dest*InvSourceAlpha

That way when Alpha = 0, Result = Dest and when Alpha = 1, Result = Source

[b]
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 15th Jul 2011 18:57 Edited at: 15th Jul 2011 19:15
Quote: " It controls how colours are blended together.

Source = colour of pixel being drawn
Dest = colour of destination pixel
Result = colour of resultant pixel

Result = Source*SourceBlend [op] Dest*DestBlend

[op] can be add, subtract, reverse subtract, minimum or maximum.

SourceBlend and DestBlend can be any of these.

By default the blending equation is:
Result = Source*SourceAlpha + Dest*InvSourceAlpha

That way when Alpha = 0, Result = Dest and when Alpha = 1, Result = Source
"


Yes, and you mention all that in the command list in your original post. But... what is a good use for the command? It doesn't return a value, so I assume it changes the operation of all A2D drawing commands. Is the source color the color of the line and the color of each pixel in a "a2DrawImage" command? And is the destination color whatever color the pixels are where the new pixels are drawn?

I've been playing around with the command, and I can't figure what to use it for. Any examples?

For instance - what is this doing? Is this even how the command is used?

EDIT:


Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 15th Jul 2011 21:06
@ Rich,

A help file, even a partial one, would be great.... more strength to your arm!

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 15th Jul 2011 21:23
Quote: "A help file, even a partial one, would be great.... more strength to your arm!"


Thanks! Really, the commands are mostly straightforward, and the intellisense works fine. I'm just a little OCD, and wanted complete help files for it. I've added the help files for Box2D, Matrix1, Image Kit, BMP Font Kit, and D3D plugins to my DBPro main menu, and the Advanced 2D help file rounds it all out.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 15th Jul 2011 21:35 Edited at: 15th Jul 2011 21:36
Quote: "Is the source color the color of the line and the color of each pixel in a "a2DrawImage" command? And is the destination color whatever color the pixels are where the new pixels are drawn?"


Exactly.

Quote: "what is a good use for the command?"


Say you want to do trails on the screen when things move. One way is to not clear the backdrop, but make it fade slowly to black. The usual way to do this is to draw a semitransparent black box over the screen, but the trails never go completely black with normal blending.

Instead, you could change the blend mode to subtractive blending:
a2SetBlendMode 2, 2, 2

(a2SetBlendMode D3DBLEND_ONE, D3DBLEND_ONE, D3DBLENDOP_SUBTRACT)

Then you could draw a filled box like so:

a2FillBox 0, 0, screen width(), screen height(), rgb(1, 1, 1)

That way the red, green and blue values of each pixel will decrease by one each frame, so will reach zero after a maximum of 255 frames.

[b]
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 15th Jul 2011 21:40
Thanks Diggsey! That should give me a good example for the help file. (And help me understand how to use the command!)

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 15th Jul 2011 21:58 Edited at: 15th Jul 2011 21:59
Hmmm... I'm getting down the to the last few commands, and a2StartTriangleBatch is not giving me the results I expect.



The batch actually takes about the same or a bit longer than the non-batched.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 15th Jul 2011 22:12
Yeah, the command probably isn't well named.

Dot batches are for dots.
Line batches are for unfilled commands.
Triangle batches are for filled commands.

[b]
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 15th Jul 2011 22:19 Edited at: 15th Jul 2011 23:11
Oh, man! Once again I just completely failed to remember that first post, where it says what you just said. Meh.

Well, I tried this...



...but I can't see that it's doing anything.

I'm just going to leave off an example for this command, if anyone wants to post one, I'd be glad to edit it in.

Anyway, here's a help file for Advanced 2D. Just unzip it into your DBPro folder and the files should all to into the right place.

Attachments

Login to view attachments
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 16th Jul 2011 11:07
@ Rich,

Sincere thanks for this!

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 16th Jul 2011 13:07 Edited at: 16th Jul 2011 13:21
Cool, I'll link to the help files from the first post

edit:
This example works:


I forgot that it needed reverse subtract as the blend operation instead of subtract. Subtract would be "result = source - dest", it should be "result = dest - source".

[b]
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 16th Jul 2011 19:05 Edited at: 16th Jul 2011 19:08
Diggsey - thanks! I notice that a2SetBlendMode is used in your TopGUI work in progress, so that also is an example I can look at.

Did you make A2D for TopGUI?

I'm putting some buttons and other controls in a new project, and this looks really good!

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 16th Jul 2011 19:13
Quote: "Did you make A2D for TopGUI?"


Not originally, but the big update I did was to add features I needed for TopGUI.

[b]
Devonps
15
Years of Service
User Offline
Joined: 5th Nov 2009
Location: Nottingham
Posted: 20th Jul 2011 12:00
Quote: "Just majorly updated the plugin. (Got bored of their being no decent text support in dbpro since the d3d plugin stopped working...)"


Really, it's still working for me in my W.I.P. - can you explain a little more for me as I rely on the D3D commands quite heavily.

Additionally how do your text commands compare to the D3D commands in terms of speed, any thoughts?

Thanks.

Steve.

Marriage is a circle of rings....
Engagement ring, Wedding ring, Suffering!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Jul 2011 12:50 Edited at: 20th Jul 2011 13:22
Quote: "Really, it's still working for me in my W.I.P. - can you explain a little more for me as I rely on the D3D commands quite heavily."


For me it stopped working after the device is reset (for example changing display mode) and even using d3d_init after the reset doesn't help.

[b]
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2011 12:56
Quote: "For me it stops working after the device is reset (for example changing display mode) and even using d3d_init after the reset doesn't help."

Works fine for me too... even after I reset the display mode as you are saying here.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Jul 2011 13:09
Hmm, there was definitely something for which it didn't work. It might have been to do with drawing to different render targets. Either way, when I was using it nothing showed up when using d3d, so I wrote a2.

[b]
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2011 13:16
I use both now. I haven't really investigated your text commands yet so I still use d3d for that at the moment.

Cloggy's dll is cool for adding 3D text objects too but I find some of your commands a little more intuitive and d3d doesn't have an equivalent to your triangle command which is indispensable!

Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 21st Jul 2011 00:43
@ Diggsey,

Some ideas - Boxed text with rounded edges? borders?

Looking at the above posts, and Cloggys dll, 3d text?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
noobnerd
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 21st Jul 2011 19:48
i had that problem too i solved it by changing the window mode to "Fulldesktop" afterthat i have been able to use both set disp mode and d3d commands
noobnerd
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 21st Jul 2011 20:53 Edited at: 21st Jul 2011 20:56
here is something i did with advanced 2d. I think set blend mode is the best command ever.



the res is 1680,1050
looks way better in fullscreen.

my comp does that in 700 ms

'thanks Diggsey for wonderfull plugin
Rampage
16
Years of Service
User Offline
Joined: 4th Feb 2008
Location: New Zealand
Posted: 22nd Jul 2011 05:43
Nice plugin! Any chance for some C++ libraries for GDK?
Haven't used DBPro for a long time

Regards,

Max
C2H2
14
Years of Service
User Offline
Joined: 3rd Sep 2010
Location:
Posted: 18th Sep 2011 23:37
I saw topGUI
But where is the download link from A2d??
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 19th Sep 2011 11:14
You can download Advanced2D from the first post using the "Download" button in the bottom right.

[b]
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Sep 2011 02:08
I have been after something that does masking like this...Click This Link. For GUI work. Photoshop takes time to make masked shapes, and they aren't very complex, usually just squares, and circles. But I thought it would be great to have an automatic GUI mask cutter that could cut complex shapes in a mathematical formula. So does this 2D program allow masking like that?

gwheycs62egydws
15
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 20th Sep 2011 03:44
Pincho Paxton

Advance2d can make the shapes as the example shows
but only that part , I know with a bit of work in coding
you should be able to create such and example
with all the commands DBP has and with the free additions
this is possible

as far as I am aware I've not seen example at this time

If a thought is Just a thought ~ so whats the main thought ?
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 20th Sep 2011 09:31
@ Resourceful & Pincho Paxton,

Beyond me really, but would SvenB's ImageKit assist with this??

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Sep 2011 10:41
It would be possible using the image kit and some messing around but it would be simpler by far to create a few sprites as shown in the example and just stretch them to fit the size required at runtime.

Using image kit and a2d would be a waste really for something that could be achieved with about 3 sprites...

gwheycs62egydws
15
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 20th Sep 2011 12:35
waste hummm

time consuming ooo ya lol

But I think worth the brain freeze ;o)

a lot of thinking and a lot of planing could turn out some
interesting results

first create the basic shapes
then give them the 3d look with the correct coloring
and ya get the final results

If a thought is Just a thought ~ so whats the main thought ?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Sep 2011 12:44
Quote: "a lot of thinking and a lot of planing could turn out some
interesting results"

Yeah, but isn't it easier to get the same results using sprites? Less 'wasteful' in terms of game speed too. Pasting a few sprites takes a few lines of code and runs really fast. Creating something like that using image kit and a2d every loop would be a waste of time and resources...

It would be fun sure but you wouldn't produce anything that looks better or runs faster.

Quote: "a lot of thinking and a lot of planing could turn out some
interesting results

first create the basic shapes
then give them the 3d look with the correct coloring
and ya get the final results"

Agreed. Same goes for doing it in GIMP...

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Sep 2011 13:49
@Pincho
It's certainly possible with this plugin. You can use the many blend modes to perform masking operations like those in the link. You could even get the curved gradients with a bit of code by drawing lots of filled triangles. It's up to you to actually do it though...

[b]
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Sep 2011 14:46 Edited at: 20th Sep 2011 14:56
Thanks for ideas. I think I have an idea now.

NickH
16
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 23rd Oct 2011 12:50
Quote: "(Got bored of their being no decent text support in dbpro since the d3d plugin stopped working...)"


Hmmm it still works fine for me? I built an entire GUI System using the D3D plugin. I wasn't aware of any problems with it?

I like the look of your plugin

IlluminatedFX.com
For web design and graphic design services
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Oct 2011 23:52
Sorry to bump this...

For some reason your plugin is drawing the shapes REALLY fat. Before I upgraded to a newer version, the outlines of the shapes had a width of 1 pixel, now they have 4 pixels. What's going on? Is there any way to fix this?

TheComet

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Oct 2011 03:26
Hmm, sounds like another plugin is changing the direct3d line width and not restoring it. Unfortunately I can't fix it right now since I don't have access to the code atm.

[b]
gwheycs62egydws
15
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 28th Oct 2011 05:22
TheComet

post the code your having the problem with

I am running the latest version
and the one example I used it with worked fine
once i fireguard out what I want look like

I've got every plug-in's posted in the forum

I know with 3 of the pay stuff they are conflicts
since the pay stuff is out of date

and a new version of dark physics is in the works
since the old one was not finished

If a thought is Just a thought ~ so whats the main thought ?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Oct 2011 10:24 Edited at: 28th Oct 2011 10:25
I get the thick line effect on my netbook when using this or cloggy's D3D plugin but I haven't considered what other plugins might be causing it. I use them with Box2D and Matrix Utility but not much else as far as I can remember...

Could it be a graphics card issue?

EDIT: I should say that I don't get it on my desktop with the same game...

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 28th Oct 2011 19:52
Not much code I can post, but here it goes:



Here's what my laptop does:



If I remove the a2line command, I get this:



TheComet

gwheycs62egydws
15
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 29th Oct 2011 02:21
umm this is the result I got

not as bad

but noticeable

If a thought is Just a thought ~ so whats the main thought ?

Attachments

Login to view attachments
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Oct 2011 03:14
When I run that code the DBPro line gets thicker but the a2 line is still the right width. I have no idea how it's getting wider as I've checked the D3D API and it's supposed to be impossible to draw thick lines without explicitly using the ID3DXLine interface (which is not used in a2, and looking through the DBPro source code is not used there either)

I can only assume that it's a by-product of some other render state that a2 sets when it draws that's causing the effect, but I can't imagine what..

[b]
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 29th Oct 2011 03:32
I like the speed out of A2D but was wondering maybe at some point there could be a slight modification to it? (okay, maybe not slight)

The idea being that, as well as clipping a line within the screens boundaries, maybe adding the option to wrap the line drawing so that if it goes off one of the edges it will carry on drawing on the opposite side.

This would make for some good procedural texture generations, especially if it also worked with circles, etc.

I can understand that if it cannot be done because I'm assuming you are using DX to draw the shapes.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Oct 2011 15:19 Edited at: 29th Oct 2011 15:20
It gets worse...





TheComet

Attachments

Login to view attachments
thenerd
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 29th Oct 2011 17:08
I've noticed a similar effect that TheComet is getting...
Another problem I've noticed is that when using a2line, it turns on anti-aliasing on wireframe objects. I can't find an example but I feel like it might somehow be connected to the other problem.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Oct 2011 18:33
Well, I've found out what's going on...

thenerd was right: it's a combination of the line antialiasing and the blend modes. DBPro resets the blend mode but not the line AA, and so ends up using a blend mode not suited for AA. The easiest work-around for this is to call "a2SetLineAA 0 : a2Dot -10, -10, 0" after drawing and before calling "sync". The offscreen dot is necessary because changes are only applied when you start drawing.

As for the problem of the a2Line itself looking thick, the only way I can reproduce that is by calling "a2SetBlendMode" with a blend mode that ignores alpha. This isn't so much a bug as a direct consequence of that blend mode when used with AA. Changing back to the default blend mode "a2SetBlendMode 5, 6, 1" before drawing your AA lines will fix it.

[b]
gwheycs62egydws
15
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 30th Oct 2011 03:29
I just used

a2SetLineAA 0

before the sync in the last example and that did the trick

at least it's a minor bug with a simple fix

If a thought is Just a thought ~ so whats the main thought ?

Login to post a reply

Server time is: 2024-11-21 16:45:58
Your offset time is: 2024-11-21 16:45:58