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 / 2d drawing commands?

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Apr 2013 18:42
Are there any draw commands yet? I found drawLine, how about a box command? Whether or not I'd use these commands in a final project, they are very useful for rapid prototype development.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Apr 2013 19:22
I believe drawLine is in the last few Beta versions and there may be others but I haven't personally used any of them yet.


this.mess = abs(sin(times#))
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 2nd Apr 2013 22:20
drawsprite is a alternate. you can paint and also get a image from back buffer.
if you don't need realtime you can use the memblocks commands.
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 2nd Apr 2013 22:24 Edited at: 2nd Apr 2013 22:25
Probably they are needed for debug purposes. Having the drawLine command it is easy to code another two functions for a rectangle and a circle
Do you need C++ code?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Apr 2013 00:28
There are some draw commands in the UCF project here: http://forum.thegamecreators.com/?m=forum_view&t=193433&b=41

They may not be native but they run fairly fast for debug purposes at least (if I say so myself)


this.mess = abs(sin(times#))
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Apr 2013 05:11
Thx baxslash. After looking through those functions, I don't think I want to rely on them. Having to use sprites and arrays just to draw a box on the screen seems kinda ridiculous.

Is there a way to access the drawing surface directly?

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 3rd Apr 2013 10:23
I don't know what you are planning Phaelax but remember that sprites are faster than drawing in AppGameKit, compared to DBP. So instead of drawing a line or a box every loop it is better to replace it with a sprite.


Demo 3 is out now!
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 3rd Apr 2013 18:53 Edited at: 3rd Apr 2013 18:53
DrawLine is the only 2D drawing command we will add for 108, it has been optimized to make drawing lots of lines very fast so things like boxes and circles can be composed using this command.
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 3rd Apr 2013 20:16
Paul:
How does it compare in speed to sprites, especially if you turn off transparency for the sprites?


Demo 3 is out now!
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 3rd Apr 2013 23:26
If you are using sprites to draw lines then DrawLine will always be faster, if you are using non-transparent sprites to draw boxes then sprites will always be faster. Irregular shapes with transparent sprites might actually be faster with DrawLine on Tegra 2 devices as that GPU suffered badly with alpha blending, otherwise I would expect a single transparent sprite to be faster than lots of lines, but I could be wrong.
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 3rd Apr 2013 23:56
Good to know. Thanks for the info


Demo 3 is out now!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Apr 2013 00:34
I just wanted to build a cubicle designer for work

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Apr 2013 00:44
If all you need are rectangular things (a square is also a rectangle), then you can go with 'blank' sprites. You create a sprite with no image (0). This creates a blank square. Then you set the dimensions and you can apply color to it as well and then place it where you want.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Apr 2013 01:06
i missing standard paint functions too (plot,oval+fill,rect+fill,round rect...) for creating images on the fly and later i want plot the images self on screen as gui or something.
its very odd in compare with other languages or someone
will convert old source code to agk for a app revival.
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 4th Apr 2013 01:09
We can just make those out of the drawline command couldn't we? It feels like the old mode-x days when one used to draw straight to the screens memory with a putpixel inline assembler function. Oldskewl

My hovercraft is full of eels
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Apr 2013 01:22
@lilpissywilly
yes, but often you want do something and you are interrupted with other things that other people have already done.
the point is if i made a new project i must include my own lib
each time or copy my own functions in this project.
if i want share my code you need all libs too.
but there already exists a thread for most used functions we need.
east
11
Years of Service
User Offline
Joined: 4th Apr 2013
Location:
Posted: 4th Apr 2013 07:36
I think some drawing commands like triangle or polygon with texture mapping would be nice. In my project, i want to create slashing effect like the one in fruit ninja when you slash the fruit. That would be easier with triangle or polygon drawing commands with texture mapping, or perhaps i miss something?
Timshark
17
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 3rd May 2013 21:42 Edited at: 3rd May 2013 22:19
I like to back this.
I understand and follow the argument of less runtime workload with premade assets.

BUT - prototyping and experimentation with ideas is essential if your'e not trying to create the new angry birds clone and know exactly where you are going. Having to pick up my drawing tablet each time I want to make some proto graphics for an idea is time wasted. The drawing commands in the ucf project are slow and space wasting for small experiments. It's also a hassle to copy and paste them. (some of them rely on subfunctions)

I back Phaelax completely on this topic - not necessarily for finalisation - but for creative coding time not vasted!

Until more 2d drawing commands arrive - I will play around with those squares!
haliop
User Banned
Posted: 4th May 2013 07:42
also when i GETIMAGE ...
when drawing lines , the lines will be one on top of the other
but when drawing sprites, the sprites will always be beneath ..
which is kinda strange....... if everything is at the same depth.. i dont understand why drawing the sprite loop after loop why would it be beneath the first draw..... makes me wonder...

Timshark
17
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 4th May 2013 16:42 Edited at: 4th May 2013 16:49
Quote: " i dont understand why drawing the sprite loop after loop why would it be beneath the first draw"


You are absolutely right. The manual also says that "Lines appear above all other drawing except the Print command"

What you can do is this:

If you call a render after you draw the line and then set the spritedepth to zero after the render the sprite will be drawn on top.

EDIT: But this really is a little off topic. The topic is - We want more drawing commands.

I never want what I know.

Login to post a reply

Server time is: 2024-11-24 13:25:28
Your offset time is: 2024-11-24 13:25:28