DSLua Community
Welcome, Guest. Please login or register.
May 18, 2012, 09:39:59 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Need Help?  |  Color in 8 bit backgrounds « previous next »
Pages: [1]
Author Topic: Color in 8 bit backgrounds  (Read 1659 times)
Jeremysr
First Quarter
***
Posts: 215



WWW
« on: October 02, 2006, 11:44:42 PM »

Could someone explain to me how 8BitBackground:SetPaletteColor() works? And also what does the "i" mean in 8BitBackground:Plot( x, y, i )?
Logged
Zhen
Waxing Crescent
**
Posts: 45


WWW
« Reply #1 on: October 03, 2006, 05:21:00 AM »

8BitBackground is a background in indexed mode or paletted mode. You can create a palette with 256 colours (8 bits) and draw in the background with these colours.

When you draw in 8BitBackground you need to create a palette before plot.

Code:
-- init background
BGBot8Bit = Screen.Load8BitBG()
Screen.Initialize( SCREEN_BOTTOM, BGBot8Bit )

--  create a palette colour for index "i=1"   with "red = 16", "green = 0" and "blue = 0"
BGBot8Bit:SetPaletteColor(  1, 16,  0,  0  ) 

From now index "i = 1" in the palette will be a dark red.

With:

Code:
-- you draw a pixel in x,y position of screen using colour "i" in the palette.
-- BGBot8Bit:Plot( x, y, i )

-- in the example, you draw a dark red pixel at 10,20 position
BGBot8Bit:Plot( 10, 20, 1 ) 

Zhen
Logged
Jeremysr
First Quarter
***
Posts: 215



WWW
« Reply #2 on: October 03, 2006, 02:29:13 PM »

Yay thanks for the quick reply! I get it now.

I'm using it for trying some 3D stuff, so far I have a 3D cube that can rotate
Logged
Pages: [1]
« previous next »
    Jump to: