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 / Colors and the Dot command

Author
Message
MIsfit410
23
Years of Service
User Offline
Joined: 14th Jun 2003
Location:
Posted: 15th Jun 2003 00:30
I come from the old school basic(RS Dos on TRS80), I was wowed when I came across Dark Basic.
I am currently running the 30 day trial on DBpro, just making sure I can grasp it before shelling out the $99, which I think I am going to do regardless..

I am toying with simple stuff that I already know how to do, right now I made a dorky little joystick controlled drawing program, I am using the Dot command.

the problem I am encountering is the colors never change, I can go up the numbers more and more, but its always either a shade of blue or a shade of green... are the colors limited in the 30 day trial? or am I doing something wrong??
(to be in depth there, I doing a basic a=100, b=100 for control and c=1 for color
dot a,b,c
when hitting the color up button, I do c=c+1
I hold it and go through thousands of colors, and its still just shades of blue.
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 15th Jun 2003 00:37
hi mate.
If you place randomize timer() at the top of the main source

then remark your colouring lines

then replace with ink rgb(rnd(255),rnd(255),rnd(255)),1

you should see a random everchanging dot colour.

if this is the case we would need to see your method for obtaining the colour, its probably something to do with the method or wording of the control of the rgb components.

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 15th Jun 2003 00:41
see in this mini example how Im just using the dot or box after the random ink call



andrew11
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 15th Jun 2003 00:41 Edited at: 15th Jun 2003 00:46
That's because you are trying to use color with one variable. Used to 256 color eh?

DBPro uses 16million+ colors. The color value equals
((blue * 255^0)+(green * 255^1)+(red * 255^2))
Blue and green are at the beginning, and red is near the end, so it would take quite a while to increase that much!

Instead, use RGB()

example:


Increase red, for the red part of the color, green for green and blue for blue.

[Edit]
Darn! Indi posted first! Oh well.. Maybe you can understand mine better.

"All programmers are playwrites and all computers are lousy actors" -Anon
Click Here!!!
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 15th Jun 2003 00:45 Edited at: 15th Jun 2003 00:46
This code sample will produce a box and a dot which cycle through all the colours in the colour spectrum:



It cycles to produce red, green and blue colour components and then uses the RGB command to convert those into a colour value (which is 4 bytes). The INK RGB command is quite slow, so avoid it where possible.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_103.zip
andrew11
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 15th Jun 2003 00:58
Mine is simalar to RobK's, but is smaller.



"All programmers are playwrites and all computers are lousy actors" -Anon
Click Here!!!
Attreid
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 15th Jun 2003 01:56
vermillon hells !
why don't you do it easy ?


"He will come...the voice from the outer world,
bringing the holy war, the Jihad, which will cleanse the Universe and bring us out of darkness."
MIsfit410
23
Years of Service
User Offline
Joined: 14th Jun 2003
Location:
Posted: 15th Jun 2003 02:03
wow, quick, and helpful..thanks guys, you set me straight.
I havent programmed since I was 12, back in the TRS-80 days..
I used Pokes for graphics, and a whopping 4 colors , I am trying to get in the hang, there are many obvious differences from RSDos here, but I understood it right away, and its really coming back to me, I LOVE this compiler.

I do miss the line numbers, I could use If/then statements, like
if returnkey()=1 then goto 7
to go to line 7, I have not yet figured out to get it to go where I want it to with such ease on this one yet... back to reading.. thanks again

Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 15th Jun 2003 12:36
easy:


if returnkey()=1 then goto label

label:

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_103.zip

Login to post a reply

Server time is: 2026-07-18 09:00:10
Your offset time is: 2026-07-18 09:00:10