Screen 13

How do you use the 256 colors in screen 13?

Comments

  • Use the color statement, like so:

    color 147
    print "put some text here"

    And that text will be color 147. Just the same as all other modes.

    : How do you use the 256 colors in screen 13?
    :


  • : Use the color statement, like so:
    :
    : color 147
    : print "put some text here"
    :
    : And that text will be color 147. Just the same as all other modes. (Well, actually, not ALL the other modes. In SCREEN 12, color 147 will look be the same shade of white as all the other colors with numbers higher than 15)
    :
    : : How do you use the 256 colors in screen 13?
    : :
    :
    :


  • You're missing the point. No, it will not look the same color on other screen modes - DUH!. I mean that the method for switching colors is the same as every other screen mode, which is just using the color statement.




    : : Use the color statement, like so:
    : :
    : : color 147
    : : print "put some text here"
    : :
    : : And that text will be color 147. Just the same as all other modes. (Well, actually, not ALL the other modes. In SCREEN 12, color 147 will look be the same shade of white as all the other colors with numbers higher than 15)
    : :
    : : : How do you use the 256 colors in screen 13?
    : : :
    : :
    : :
    :
    :


  • : How do you use the 256 colors in screen 13?
    : : How do you use the 256 colors in screen 13?
    : Hello, programmer!
    This is Dr. COM WIZ. You seem to be having some trouble with SCREEN 13, eh? The counsel that was given to you previously should have been somewhat helpful. But I was concerned about the way you stated your question. You asked "How do you use the 256 colors in screen 13?" Correct me if I'm wrong, but that sounds like the question of an ameteur programmer. So, I'll explain this in a way an ametaur would understand.

    If you know about screen modes, then you should know about color codes. What's a color code? Well, unfortunatly, QBasic would not allow us to use words like "Blue" or "Green" to tell it what color we want something to be. Therefore, we have to use color codes that will symbolize these colors.

    Each screen mode has it's limit of available colors. SCREEN 0 has 32 (I think), SCREEN 2 has 2, and, of course, SCREEN 13 has 256. Since the available colors for each screen mode vary, the color codes for different screen modes might likewise vary. To get the proper color code for each available color in each screen mode, the following program can be used:

    SCREEN 13
    FOR col = 0 TO 255
    COLOR col
    PRINT "This is color code number"; col
    NEXT col

    Do I have to explain FOR...NEXT loop? First, our variable, col, is assigned a value of 0. Then the value of this variable is used to complete the COLOR statemnt. So, it would be the same as COLOR 0. Then, col has a new value--1. COLOR 1, then COLOR 2, and so on. Not only that, but the value of col is printed along with the string in it's current color. The (;) before the variable lets QBasic know that he has to PRINT this variable, too. How far should col go? If it goes too far, than your program will end with an error. In Qbasic's Survival Guide, you can find out how many colors are in each SCREEN mode, but you need the above program to tell you the color code for each color. Col, the variable, should go from 0 the number of colors munus 1.

    Now that we can use these colors for text, why not for graphics? Of course we can. Just stick the color code into your graphjics statement like so:

    SCREEN 13
    CIRCLE(120, 120), 10, 113 'will draw a circle
    ' ^
    ' color code 3

    PSET (120, 120), 125 'will make a dot, or pixel
    ' ^
    ' color code five

    Now that we know what we're doing, dig this program made before.
    If you're an artist, like me, you can use these many colors for shading 3D figures like this:

    SCREEN 13
    x1 = 50: y1 = 50
    x2 = 150: y2 = 150
    FOR col = 31 TO 17 STEP -1
    x1 = x1 - 2
    x2 = x2 - 2
    y1 = x1 + 2
    y2 = y2 + 1
    LINE (x1, y1)-(x2, y2), col, B
    NEXT

    Don't try to understand the math. It's not worth it, becuase it's really not important. Once you become a more proficient programmer, you'll start using lots and lots of math in your programs like I do now. This just demonstrates the beauty of 256 colors.

    I hope I helped.
    --Dr. COM WIZ



  • Well, you really have a way of pissing people off. For your information, I am only new to GRAPHICS. I just wanted an answer, not some guy who thinks he knows everything (hey, maybe you do) to give me crap. Heres what I've been doing instead of graphics:

    '-----------------------------------

    For x = 1024 to 1124 'It is something like that but you'll a a = peek(x) 'get the idea
    Print chr$(a)
    Sleep
    Next x

    '------------------------------------

    That should give you some of QuickBasic 4.5's menus.

  • Oh and by the way, I know you can't "blue" and "green".



  • : Well, you really have a way of pissing people off. For your information, I am only new to GRAPHICS. I just wanted an answer, not some guy who thinks he knows everything (hey, maybe you do) to give me crap. Heres what I've been doing instead of graphics:
    :
    : '-----------------------------------
    :
    : For x = 1024 to 1124 'It is something like that but you'll a a = peek(x) 'get the idea
    : Print chr$(a)
    : Sleep
    : Next x
    :
    : '------------------------------------
    :
    : That should give you some of QuickBasic 4.5's menus.

    : Hello, Puzzler!
    This is Dr. COM WIZ. I'm truly sorry for pissing you off. That wasn't my intention, I shouldn't have called an ametuer without even knowing you. But, to me, that [italic] does [/italic] sound like an ametuer question. Not the information asked, just the way you asked. Next time, I'll be more careful with the way I write messages and tutorials on the internet.
    To tell the truth, I don't know every QBasic command. I don't even know how to use PEEK! I'm 13 years old and started programming when I was 12. These past 9 months of programming was not enough to get me in the advanced stage, but I'm slowly reaching it. I'm working on a game called Extreme PacMan, which will be available on my website in probably a few weeks to a month. I'll give you the address when it's ready because now is not the time to see it. It's still work in progress, that is, the site and the game.
    Again, I apologize for my comments and hope there will be peace between us from now on.
    --Dr. COM WIZ.


  • Hey, don't be so hard on him. If it were anyone else asking I would think you're a beginner. But you sound otherwise like you know your stuff, so i'd think twice about it. here for example:
    http://programmersheaven.com/msgboard/read.asp?Board=15&MsgID=69251&Setting=A9999F0001


    : Well, you really have a way of pissing people off. For your information, I am only new to GRAPHICS. I just wanted an answer, not some guy who thinks he knows everything (hey, maybe you do) to give me crap. Heres what I've been doing instead of graphics:
    :
    : '-----------------------------------
    :
    : For x = 1024 to 1124 'It is something like that but you'll a a = peek(x) 'get the idea
    : Print chr$(a)
    : Sleep
    : Next x
    :
    : '------------------------------------
    :
    : That should give you some of QuickBasic 4.5's menus.
    :


  • Hey!

    Sorry 'bout what I said. I was ticked off before I wrote it and my anger just got carried over.



  • : How do you use the 256 colors in screen 13?
    :

    Here's a post from some time ago. I tried to put a link to it, but that did not work. So.. I copied and pasted it.

    Subject: Thank you, here's more!
    Posted by: AdamC on February 05, 2001 at 11:58:01 PM
    You have made my day. If you'd like some more things to try, research the DRAW command, and play around with it some. Now, for making your own colors, try this code:

    OUT &H3C8, colornumbertochange
    OUT &H3C9, redcolor, in 0-63 range
    OUT &H3C9, greencolor, in 0-63 range
    OUT &H3C9, bluecolor, in 0-63 range

    Do that for each color. Make sure you include red, green, and blue. Why 0-63? Don't know. but, that's the max color values that qbasic can handle. 0-63 is a 6 bit number. If you enter 64, qbasic will see it as 0. Unless your entire palette consists of 0-63, you'd think you're screwed, right? WRONG!

    So, what about numbers in the range of 0-255? 8 bit numbers? My knowledge is yours, learn this well.

    x+1
    x/4
    x+1
    x=abs(int(x))

    Where x is your color. Observe! *waves hands*

    IF x = 255
    x+1 = 256
    x/4 = 64
    x-1 = 63

    Hrmm, 63 is the limit! HOLY HELL! IT WORKS! muhahahahah!

    That works with any number (from 0-255, mind you). Now, you may think that you don't do it for 0-63, but you'd be wrong. All remappings from 8 bit down to 6 bit should be used. Now, see the abs(int(x)) there as your last line? Here's why:
    If x=0,
    x+1 = 1
    x/4 = .25
    x-1 = -.25

    I'm not sure, but a negative number is seen as the highest on the scale, so 0,0,0 for an rgb value would be 63,63,63 to the computer. The abs(int(x)) ensures that even negative values are seen as positive values, and .25 would round down to 0. WOOHOO!

    Enjoy the code, and you have my thanks for your thanks. Knowing one person got use out of it pleases me much. Now, I won't leave you without an example program. This is a duplication of the Ultima VII: The Black Gate's loading screen.

    Requires VGA adapter.
    [code]
    SCREEN 13
    'If you want, change this string to something you'd like. The possibilities
    'for the draw command are quite numerous. Now, on with our program. :)
    'Enjoy. -AdamC
    pattern$ = "r2l1u1d2"
    FOR a = 0 TO 255
    OUT &H3C8, a
    r = a + 1
    r = r / 4
    r = r - 1
    r = INT(ABS(r))
    OUT &H3C9, r
    OUT &H3C9, 0
    OUT &H3C9, 0
    'Grayscale, kinda a neat effect.
    'OUT &H3C9, r
    'OUT &H3C9, r
    'OUT &H3C9, r
    'Blue, this looks pretty nice as well.
    'OUT &H3C9, 0
    'OUT &H3C9, 0
    'OUT &H3C9, r
    '
    'I used r for the variable, but if you want to mix colors, it goes red,
    'green, blue, in that order. Just use r for each of them (for smooth color changing)
    'or different variables if you'd like. For some wacky colors, make one variable
    'a random one, then run the bit mapping code (the x=x+1...) on it, and change
    'the palette.
    NEXT a
    DO
    kbd$ = INKEY$
    IF kbd$ <> "" THEN EXIT DO 'Standard little keypress=exit.
    'if you want to, you can add in a few extra lines (and subs) to include mouse
    'movement = exit, but keypress works just fine.
    'If it's still up, http://www.qbasic.com has the code to activate and use the mouse.
    xcoord = INT(RND * 321)
    ycoord = INT(RND * 201)
    designcolor = INT(RND * 256)
    'Random numbers count from 0-x, not 1-x, so if +1 on your max range, then the
    'number that you really want to be max should get picked. like int(rnd*1)
    'would always yield 0, but int(rnd*2) will give 1 or 0. neat, eh?
    DRAW "BM" + LTRIM$(RTRIM$(STR$(xcoord))) + "," + LTRIM$(RTRIM$(STR$(ycoord))) + "c" + LTRIM$(RTRIM$(STR$(designcolor))) + pattern$
    'BM=BLANK MOVE. prevents design mutilation, or enhancement, depends on your
    'view. Also a long string, be sure to get all of it.
    LOOP
    SCREEN 0
    END 'or SYSTEM if using QBasic 1.x
    'And, that's it.
    'On the last two OUT statements, I used 0, meaning only red would be covered.
    'If you want something like blue, make the first one, 0, the second one 0,
    'and the third one that isn't a 0.
    '
    'The coolest thing about pattern$ is that it's your shape. You can change it
    'from plus signs, to something like a bug, or whatever your mind can imagine.
    [/code]
    -AdamC

    Ahh, can you tell i love to type? lol. I'm really going to post now. :)






  • So now I can use the 256 colors... But does anyone know how to get better resolution? 320 * 200 is really lame on an 800 * 600 monitor.

  • Get yourself an SVGA or VESA library, assuming you have at least QB 4.5. Qb45.com is probably your best bet for finding one - people say Future.Library is good, but i haven't tried it. Anyway, though, the graphics don't go up to higher resolutions without using SVGA/VESA. But then again, your programs may lose some compatability with it


    : So now I can use the 256 colors... But does anyone know how to get better resolution? 320 * 200 is really lame on an 800 * 600 monitor.
    :


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories