DSLua Community

General DS Programming Chats => Code Hashing => Topic started by: Blalien on June 20, 2007, 11:23:44 AM



Title: Background image problem
Post by: Blalien on June 20, 2007, 11:23:44 AM
Hello,

I was just testing some things with an existing script, but i encounterd a problem with the background image and text
When i start the script, the text pops up in the bottom screen and then the image pops up in the upper screen and the text dissapears again.

Does someone know te problem?


heres the script:

Code:
-- declaration
SCREEN_TOP      = 1
SCREEN_BOTTOM   = 0

BGTop16Bit = Screen.Load16BitBG()
BGBotText = Screen.LoadTextBG()
--BGBot16Bit = Screen.Load16BitBG()
Screen.Initialize(SCREEN_TOP, BGTop16Bit)
Screen.Initialize(SCREEN_BOTTOM, BGBotText)
--Screen.Initialize(SCREEN_BOTTOM, BGBot16Bit)

-- print some instructions
BGBotText:PrintXY( 0, 0, "Lights, LEDs, Lids, and Screens" )
BGBotText:PrintXY( 0, 2, "Press A to Toggle Bottom Light" )
BGBotText:PrintXY( 0, 3, "Press B to Toggle Top Light" )
BGBotText:PrintXY( 0, 4, "Press X to Toggle LED Blinking" )
BGBotText:PrintXY( 0, 5, "Press Y to Toggle LED Speed" )
BGBotText:PrintXY( 0, 6, "Press L to Toggle Screens" )
BGBotText:PrintXY( 0, 8, "Close DS to Toggle Lid Indicator" )
BGBotText:PrintXY( 0, 10, "Press START to exit" )

screenLight0Status = 1
screenLight1Status = 1
ledBlinking = 0
ledSpeed = 0

file = assert(io.open("test.bmp", "rb"))
image = file:read("*all")
Image.LoadBMP(SCREEN_TOP, 0, 0, image)

--file2 = assert(io.open("test2.bmp", "rb"))
--image2 = file2:read("*all")
--Image.LoadBMP(SCREEN_BOTTOM, 0, 0, image2)

-- enter play loop
while true do
  if Pads.A() then
    if screenLight0Status == 1 then
  screenLight0Status = 0
    else
      screenLight0Status = 1
    end
    DSLua.SetScreenLight(0, screenLight0Status)
    while Pads.A() do
    end
  end
  if Pads.B() then
    if screenLight1Status == 1 then
  screenLight1Status = 0
    else
      screenLight1Status = 1
    end
    DSLua.SetScreenLight(1, screenLight1Status)
    while Pads.B() do
    end
  end
  if Pads.X() then
    if ledBlinking == 1 then
  ledBlinking = 0
    else
      ledBlinking = 1
    end
    DSLua.SetLedBlink(ledBlinking, ledSpeed)
    while Pads.X() do
    end
  end
  if Pads.Y() then
    if ledSpeed == 1 then
  ledSpeed = 0
    else
      ledSpeed = 1
    end
    DSLua.SetLedBlink(ledBlinking, ledSpeed)
    while Pads.Y() do
    end
  end
  if Pads.L() then
    DSLua.SwitchScreens()
    while Pads.L() do
    end
  end
  if DSLua.LidClosed() then
    DSLua.SetScreenLight(0, 0)
    DSLua.SetScreenLight(1, 0)
    DSLua.SetLedBlink(1, 1)
    while DSLua.LidClosed() do

    end
    DSLua.SetLedBlink(ledBlinking, ledSpeed)
    DSLua.SetScreenLight(0, screenLight0Status)
    DSLua.SetScreenLight(1, screenLight1Status)
  end
  if Pads.Start() then
    break
  end
  Screen.WaitForVBL()
end