Skip to main content

Posts

Showing posts with the label colors

(IX) Colors: depth, color & rgb

Helo everybody! In this entry we will see how to work with colors . We will use the already known screenres instruction to define a depth color of 4 bits per pixel (4 bpp) to have 2^4=16 colors labeled from 0 to 15. Color 0 is black and also works as transparent in 4bpp. Take a look at this code: Let me explain the new keyword used: color  to change foreground and background colors. Must be followed with a cls to submit the changes. When we execute this code we can see foreground and background colors changing with every step of the loop through all its possible values. This is one of this: If we want to define 24 bpp depth we can use the instruction rgb to generate the color value. rgb means red, green & blue components and we can use numbers from 0 to 255 to indicate the amount of each color this way: rgb(0,0,0) for black rgb (255,255,255) for white rgb(255,0,0) for all red rgb(0,255,0) for all green rgb(0,0,255) for all blue rgb...

(IV) Draw some colored squares: line -step

Hello everybody! Let's enrich our first code drawing four colored squares. This is the result of our new code: An screen to play with 400 pixels of width and 300 pixels of height and four squares of 32x32 pixels one in each corner. The white square is painted or filled with same color. Let me explain the new keywords used: line  to draw a line between a point referenced with its coordinates (value in axis x,value in axis y) and an increment/decrement in pixels form this point -step(inc/dec in axis x,inc/dec in axis y) and two parameters separated by comma, the first is the color and the second is optional, if you used it you can put a b that means box or bf that means box filled. Try changing color values from 0 (black or transparent) to 15 (white) and experiment with the parameters. This is e nough by now, in t he next entry we will make great advance learning a change in the structure of the code because the famous game loop. Contact me for any question,...