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.

DarkBASIC Professional Discussion / - DBPro Coding Challenges -

Author
Message
Halo Man
20
Years of Service
User Offline
Joined: 5th Nov 2005
Location:
Posted: 23rd Jun 2006 23:26
Sounds great, i'll join this challenge.
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 23rd Jun 2006 23:35 Edited at: 23rd Jun 2006 23:41
Gervais, GUI details for calculator:
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jun 2006 19:36
Quote: " It will teach us how to do simple timer based animations without media"

take a look back at the stickman challenge.

I'll try not to disappear during this challenge, this is one I've been wanting to do for awhile.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
David Gervais
Retired Moderator
20
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Montreal, Canada
Posted: 25th Jun 2006 13:38
Lower Logic, thanks for the detailed info on the dBPro Calc.

lol I like the last line of the code/info.. "I'll be happy to help with any programming aspect of the GUI-program interaction."

Dude, I'll be doing artwork, no coding is involved in that. Coding IS your job

I'll see about getting some artwork posted soon. (will work on it in my spare time)

Have a Great Day, Cheers!
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 25th Jun 2006 13:57 Edited at: 25th Jun 2006 14:02
I guess I'm the first to put in an entry:



I have put a LOT of effort in the window-based GUI.
Press the button with the page on ('new') to create a window with a 48x48 image(You can create multiple windows). You can draw by clicking on the image in the window.
You can edit different images in different windows.

The program is still very flexible. Which means it won't be very difficult to make the input for the size of a new image, or the editing, or the loading, tools, etc.

Have fun with it!


note: don't mind the number top-left, it indicates the current active window.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 25th Jun 2006 22:52
Looking good Sven B!
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 26th Jun 2006 00:38
It certainly does look good! I do like that you run that application at desktop res of 1280x1024 and yet you dont tell DBP to run at that too hehe. I assume you have a flat screen (thats a common res for TFT's). TFT's produce their best output at top resolution.

[center]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Jun 2006 08:44 Edited at: 26th Jun 2006 11:07
All I got to say is, I HATE DYNAMIC VARIABLES! Ok, after getting that sorted out here's my GUI so far. You can reorder the layers, which should give you an idea of what kind of art package i'm going to make.


For right now, top layer colors in red, middle is green, bottom is blue. Draw something on each layer then reorder the layers to see it show up behind others.





"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
The end is near
21
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 26th Jun 2006 09:41
ok. improved code above. will allow size's 1-9 at the moment.
thank you phaelax!

stargate sg-1 the one show that never gets old
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Jun 2006 10:30
Huh? This isn't your blood script thread if thats what you're referring to.

p.s. Oooo, just hit 100th page.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 26th Jun 2006 11:17
@Phaelax - that is actually a REALLY nice snippet - on its own it could prove really usefull! I love the way it slides into position rather than jumps. Would be cool if you did the same for the one you're swapping with (maybe use the curvevalue function so it kind of decelerates into position?)

[center]
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 26th Jun 2006 12:19
Just dropping in from afar - glad to see everything still moving along nicely! Another four weeks until our house is finished and ready to move into, then I'll be set up again and back in action. Shame I'm missing this paint program challenge - would have been just my cup of tea!

Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 26th Jun 2006 12:41 Edited at: 26th Jun 2006 12:42
well at least it gives other people a chance to win

EDIT:
Oh yeah - has someone collated the entries from that last challenge together in a ZIP so I can add them to the database? Its usually the responsibility of the challenge judge

[center]
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 26th Jun 2006 15:17 Edited at: 26th Jun 2006 15:31
doh...

ok

<edit> zip file attached

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 26th Jun 2006 19:13
Cheers Sven - The results are up!
http://dbp-site.com/challenges/maths-parser

[center]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Jun 2006 20:06
I haven't looked at your site in awhile.
Clicked on my name for the math challenge, I like how it sort of asks if you're the "Winner?", then just simply says NO!

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Jun 2006 21:34 Edited at: 28th Jun 2006 20:53
Added color/alpha sliders. The alpha effects the drawing color, not the layer's overall transparency. (which will be included soon enough)




"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 26th Jun 2006 23:18
You're really getting into this challenge!

Are you going to just make it export as a JPG, etc or are you going to create a custom file to preserve the layers (maybe a .phlx)?

[center]
The end is near
21
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 27th Jun 2006 01:47
ohhh. lol, wrong thread !!!

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Jun 2006 04:24
phlx? what's that stand for? Perhaps some sort of layered format would be a good idea. By default, it'll save as whatever "save image" allows for. Other formats are a challenge all on their own.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 27th Jun 2006 08:22
phlx = Phaelex
He said custom file!


I have the longest Biog under my profile button!

"You don't know the power of Dark Basic Pro!"

-Darth Vader-
Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 27th Jun 2006 10:46
Little start here. right now LMB draws and RMB selects color under the mouse

Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 27th Jun 2006 11:25
Oh man....

I'll have to completely rewrite my program. Sprites don't like mouse editing
I tried every possible way, but every time, no avail...

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
sixblades
21
Years of Service
User Offline
Joined: 30th Jul 2004
Location:
Posted: 27th Jun 2006 18:13
Every possible way? What do you mean by mouse editing? If I recall correctly, don't they just get their data from an image? (Sprite num,x,y,img num?)

Couldn't you figure out where the mouse is in relation to the sprite, then find that bit of data on a memblock made from the image and edit it?

Hmm...or maybe I'm not understanding what your problem is...
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Jun 2006 19:03
I'm using sprites to display the images just fine.



I only recreate the image from a memblock when the memblock changes.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 28th Jun 2006 01:27 Edited at: 28th Jun 2006 03:01
Starting on the interface and an actual palette.

sixblades
21
Years of Service
User Offline
Joined: 30th Jul 2004
Location:
Posted: 28th Jun 2006 02:33
Starting from the ground up, working on finishing the GUI before anything else. As of yet, only have about 3 more windows to fine tune before I'm reading to start integrating the actual image processing (which I've been developing in another DBP program file):

This is my first real GUI that I've made, usually I'm too lazy to bother making a nice one. (feedback?)

Also, are we allowed to encode media in the file? As in, use data statements to make some buttons and such for brushes, tools, etc.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 28th Jun 2006 02:51
I personally have no problem with using Data statements to hold brushes - thats part of the functionality.

There have been many debates on where to draw the line. Basically, it comes down to not taking the piss! The rules are no external media. The reason it to make the focus on programming and not spending 24 hours playing in Photoshop.

In one entry Ric made wrote a program which generates hundreds of data statements. This eventually was deemed ok as the data statements were generated by a medialess program and the result was still "copy and pastable" into DBP.

[center]
Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 28th Jun 2006 03:01
Quote: "I personally have no problem with using Data statements to hold brushes - thats part of the functionality."


Good, I was a little worried about not being able to use data for this.
Halo Man
20
Years of Service
User Offline
Joined: 5th Nov 2005
Location:
Posted: 28th Jun 2006 03:07 Edited at: 28th Jun 2006 04:57
Heres mine so far:



and an image...



You choose the size of the drawing area at the beggining, and it creates a drawing area that size. You can use line, pencil and circle so far.

You can't see the line or circle while your making it, but you can guess where it will go for now.

EDIT: Added color!Left Click on the R,G, or B to increase the amount of the color, right click to decrease.
Benji
20
Years of Service
User Offline
Joined: 17th Dec 2005
Location: Mount Doom
Posted: 28th Jun 2006 03:26 Edited at: 28th Jun 2006 03:26
@ Phaelix

Neat

Are you going to add the pick color tool to you program?

@ Halo Man

Looking good

My Specs: Geforce 6200 128 MB.,3.0 GHZ Pentium 4 Processer, 512 MB Ram.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 28th Jun 2006 04:03
Quote: "Are you going to add the pick color tool to you program?"

piece o' cake.


@Hobgoblin
I like the palette

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 28th Jun 2006 06:14 Edited at: 28th Jun 2006 20:55
Now you can select brush size (still square shape) and hide layers.




I changed the sliders. I don't really like how they take up so much room, but I had to make them 256 pixels long or else the user couldn't reach every value in the color range.




"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 28th Jun 2006 08:09
Quote: "@Hobgoblin
I like the palette"


Feel free to use the data if you want, over winning I would like to see the best app possible come out of this.
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 28th Jun 2006 14:38
Quote: "Every possible way? What do you mean by mouse editing? If I recall correctly, don't they just get their data from an image? (Sprite num,x,y,img num?)

Couldn't you figure out where the mouse is in relation to the sprite, then find that bit of data on a memblock made from the image and edit it?

Hmm...or maybe I'm not understanding what your problem is..."


This is the problem: speed.

I had 1 sprite -> window + canvas.
Every time you wanted to edit it, it had to calculate the position on the canvas, change the canvas, and also update the position on the window. Result: Very slow.

The way i'm going it now: windows are images, and the canvas is a separate image on the window. This means that I only have to edit one image: the canvas image. Result: much faster, and easier to display cursors



No code this time. Needs some tweaking in the resizing part. And I still need to add the circle and box tool.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 28th Jun 2006 20:34 Edited at: 28th Jun 2006 20:53
Quote: "Also, are we allowed to encode media in the file?"

Yeah.

Phaelax - Very nice layers.

SvenB - Great window interface.

Hobgoblin Lord - Good pencil drawing and color picker.

Halo Man - Good start on different tools.


Couldn't resist coding up a fun little spray paint thing myself, just for fun. Maybe it'll give people ideas of tools to add when they're ready. Just left/right/left&right click and move mouse around to paint:



edit:Nicholas Thompson, I tried copying my entry from http://dbp-site.com/challenges/maths-parser/lower-logic to dbp and tried to compile it, but it gave errors, and the code was slightly changed. I looked at the page source and it looked alright, but when Firefox or MSIE renders the html, the browser reads the less-than signs in my if statements and thinks they are tags. I found this problem also made several other entries not compile, including Daemon's winning entry to the island terrain challenge.

To fix this I'd replace all less than signs with < and all greater than signs with > so browsers don't think things like <timer0 are a tags.
Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 28th Jun 2006 20:45
Added in 20 levels of Undo using ctrl-z


Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 28th Jun 2006 22:34 Edited at: 28th Jun 2006 23:07
@Lower Logic - thanks very much for noticing that! *goes off to fix the module*

EDIT: Problem solved... Also trying to optimize the code a little. ALSO trying to think of a way of stopping keyworks getting highlighted when used as variable named (eg, function$) or var_type. There must be a general rule.

[center]
Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 28th Jun 2006 23:28 Edited at: 28th Jun 2006 23:29
Added in flood fill (uses the middle mouse button for now), Though once in a great while it will only fill 1/2 the object (any thoughts?).



Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 28th Jun 2006 23:33
Looking good! Not sure why it would half fill... Unless your shape leaks infinately horozontally? Should there be a boundary check?

Just a quick update - I've fixed the highlighter now. It doesn't break on symbols and also doesn't break when you use function names in variables

[center]
Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 28th Jun 2006 23:45
Of course I can't get the problem to reproduce when I want it to :-| . I have it check the boundries by seeing if an adjacent point is the color that is being filled or another, when it half fills, say a circle, it will just stop horizontaly and leave a portion the original color, dont know if it is perhaps a problem with the point command not being 100% acurate or not.?
Tinkergirl
23
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 29th Jun 2006 14:59
Watch out for the point command - it apparently can work differently depending on your graphics card. Kenjar had a nightmare with it a few weeks ago trying to read a map in as a bitmap.

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Jun 2006 19:27
I've had unusual problems with point as well.

I've made myself a hard problem with drawing. Since I'm drawing straight to memblocks, I have to do my own line algorithm, circle, etc....

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 29th Jun 2006 19:33
teehee... I wrote a function a while back which draws a line using the midpoint algorithm to a memblock... I'll look it out for you later if you like (I'm at work right now).

[center]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Jun 2006 19:55 Edited at: 29th Jun 2006 19:56
its ok, i got bresenham's algorithm.

if anyone else needs it:


Now for the circle.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
sixblades
21
Years of Service
User Offline
Joined: 30th Jul 2004
Location:
Posted: 30th Jun 2006 08:46
Thanks Phaelax, that's awesome (I'd been contemplating on how to to that for some time and have it still look good).

Here's a simple function I made that might also be useful to anyone using memblocks, it takes the x and y coordinates of an image and returns the exact spot in the memblock.

Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 30th Jun 2006 11:39
nice function! I've never thought of doing that... I tend to combine the two formula's and just use that directly in the line of code! It does assume the function knows the global variable "width" though...

[center]
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 30th Jun 2006 15:59 Edited at: 30th Jun 2006 16:01
Just dropping in to make the 4000th post - hehe

Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 30th Jun 2006 16:40
DAMMIT!!! I've been waiting for that for 999 posts!!! And I missed it by 1 :-(

[center]
Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 30th Jun 2006 20:10
at least it was ric, could have been some super yutz asking if DB would make a MMORPG for him. Just spam the forum another 998 times and you can have #5000

http://www.cafepress.com/blackarrowgames
Check out my great stuff here

Login to post a reply

Server time is: 2026-07-09 01:48:30
Your offset time is: 2026-07-09 01:48:30