DSLua Community
Welcome,
Guest
. Please
login
or
register
.
May 18, 2012, 09:26:38 PM
1371
Posts in
262
Topics by
33109
Members
Latest Member:
Limewire Download
Home
Help
Search
Login
Register
DSLua Community
|
DSLua - Best scripting language for Nintendo DS
|
Need Help?
|
Blitting
« previous
next »
Pages:
[
1
]
Print
Author
Topic: Blitting (Read 1781 times)
bronxbomber92
New Moon
Posts: 3
Blitting
«
on:
August 01, 2006, 11:13:44 PM »
Hey, I'm brand new to DSLua today, and rather experianced with PSPLua. I need help blitting images to the scrren, as I see its not as easy as
Code:
menu = Image.Load("menu.png")
screen:blit(0, 0 menu)
Could someone please help me, I'm porting a PSP lua game to the DS, so I can post that code if anyone needs to take a look at it, Thanks.
Logged
daltonlaffs
First Quarter
Posts: 189
Freaking Insane
Re: Blitting
«
Reply #1 on:
August 02, 2006, 12:10:38 PM »
At the current time, .png images are not supported in DSLua. You must use a 256 color bitmap and convert it using gfx2gba.
Logged
Code:
-- Bored? Read code line below.
-- Bored? Read code line above.
^^ That works, I SWEAR! ^^
bronxbomber92
New Moon
Posts: 3
Re: Blitting
«
Reply #2 on:
August 02, 2006, 03:34:47 PM »
Yes, that is the one thing I do know, but I dont know how to load the image then blit it. I dont need to blit on the bottom screen yet. so Let me show you the equivalent of wat I need.
Code:
Music.playFile("start/sonicdrm.s3m", true)
Menu = Image.load("start/MainMenu.png")
Quit = Image.load("start/Quit.png")
QuitOver= Image.load("start/QuitOver.png")
Start = Image.load("start/Start.png")
StartOver = Image.load("start/StartOver.png")
menunum = 1
while true do
pad = Controls.read()
screen:blit(0, 0, Menu)
screen:print(0,0,"netlib version - press R for online play")
if pad:down() then
menunum = menunum+1
screen.waitVblankStart(10)
end
if pad:up() then
menunum = menunum-1
screen.waitVblankStart(10)
end
if menunum==0 then
menunum=menunum+2
end
if menunum==3 then
menunum=menunum-2
end
if menunum == 1 then
screen:blit(146, 205, StartOver)
screen:blit(146, 229, Quit)
end
if menunum == 2 then
screen:blit(146, 229, QuitOver)
screen:blit(146, 205, Start)
end
if menunum == 1 and pad:cross() then
mode = "game"
dofile("Charselect.lua")
end
if menunum == 2 and pad:cross() then
break
end
if pad:r() then
mode = "online"
dofile("Charselect.lua")
end
screen.flip()
end
I know the music commands, print command( which is print() )and I know the Pads commands. But I wish to load and blit these images. Any help?
Logged
Zhen
Waxing Crescent
Posts: 45
Re: Blitting
«
Reply #3 on:
August 03, 2006, 03:52:45 AM »
Hi,
The best option that you can try are sprites. Load a sprite Frame Strip with all button states, and change the actual sprite instead of blitting.
Code:
SCREEN_BOTTOM = 0
SPRITE_PALETTE = 0
Sprite.LoadPalette( SCREEN_BOTTOM, SPRITE_PALETTE, "sprite.pal" )
StartButtons = FrameStrip.Create( SCREEN_BOTTOM, 64, 32, "256" )
StartButtons:LoadBin( "startbuttons.raw", 2 )
Start = Sprite.Create( StartButtons, 0, SPRITE_PALETTE, 146, 205 )
while 1 do
-- blabla
if menunum == 1 then
Start:SetFrame( StartButtons, 1 )
-- Quit:SetFrame( QuitButtons, 0 )
end
if menunum == 2 then
Start:SetFrame( StartButtons, 0 )
-- Quit:SetFrame( QuitButtons, 1 )
end
end
Start:Free()
StartButtons:FreeAll()
You can look for examples in DSLua zip about *.pal and *.raw creation.
Zhen
Logged
bronxbomber92
New Moon
Posts: 3
Re: Blitting
«
Reply #4 on:
August 03, 2006, 11:17:06 AM »
But these arent all from one "sprite sheet". these are seperate pics. Is their not a way to simply blit picture?
Logged
Zhen
Waxing Crescent
Posts: 45
Re: Blitting
«
Reply #5 on:
August 03, 2006, 05:48:57 PM »
Quote from: bronxbomber92 on August 03, 2006, 11:17:06 AM
But these arent all from one "sprite sheet". these are seperate pics. Is their not a way to simply blit picture?
Well that's true, but I think also that it's the best way to made the things that you want.
Another way is, using putpixel, make the blit function yourself. But you need to load the image.
Zhen
Logged
Pages:
[
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
DSLua - Best scripting language for Nintendo DS
-----------------------------
=> News and Announcements
=> Examples/Tutorials
=> Home-brew/Hacks/Games/Projects
=> Hardware and Equipments
=> Need Help?
=> Bugs & Suggestions
-----------------------------
General DS Programming Chats
-----------------------------
=> Code Hashing
=> Chat Room
=> Test Area
Powered by SMF 1.1 RC2
|
SMF © 2001-2005, Lewis Media