Thursday, 20 November 2008
 
  Home arrow Forum  
Main Menu
Home
News
Forum
Documentation
Download
Links
Administrator
Login Form
Welcome, Guest. Please login or register.
November 20, 2008, 06:23:37 AM
Username: Password:
Login with username, password and session length

Forgot your password?
Background image problem
DSLua Community
Welcome, Guest. Please login or register.
November 20, 2008, 06:23:37 AM
1723 Posts in 315 Topics by 5663 Members
Latest Member: cakecream
DSLua Community  |  General DS Programming Chats  |  Code Hashing  |  Background image problem « previous next »
Pages: [1]
Author Topic: Background image problem  (Read 663 times)
Blalien
New Moon
*
Posts: 1


« 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
Logged
Pages: [1]
« previous next »
    Jump to:  



    (C) 2008 DSLua

    DSLua - Best scripting language for Nintendo DS home-brew!