android
  #1  
Old 03-04-2010, 04:11 AM
nipico nipico is offline
Junior Member
 
Join Date: Feb 2010
Posts: 43
Default I can't load a picture

Hello when I start my programm the screen still black and the picture doesn't appear. What's the problem?

code:

height = screen.height()
width= screen.width()
black = color.new(0,0,0)
screen.fillrect(0,0,width,height,black)
screen.update()
image.setresource("Pic.bin")

PlateauAll = image.load("Pic/PlateauAll.png")
PlateauAll:draw(0,0,widht,height)
screen.update()
while 1 do
if control.isButton() == 1 then
PlateauAll:close()
break
end
os.sleep(10)
end
Reply With Quote

Advertisement [Remove Advertisement]

  #2  
Old 03-04-2010, 05:20 AM
JJLoke JJLoke is offline
Junior Member
 
Join Date: Jan 2010
Posts: 87
Default

PlateauAll:draw(0,0,widht,height)

spelling error

if that does not help, try not to use .bin extension. name a folder to "pic" instead
Reply With Quote

  #3  
Old 03-04-2010, 05:36 AM
nipico nipico is offline
Junior Member
 
Join Date: Feb 2010
Posts: 43
Default

Quote:
Originally Posted by JJLoke View Post
PlateauAll:draw(0,0,widht,height)

spelling error
sorry but i don't see the spelling error
As regards bin i must say image.setresource("Pic"). Is that it?
thx
Reply With Quote

  #4  
Old 03-04-2010, 07:55 AM
JJLoke JJLoke is offline
Junior Member
 
Join Date: Jan 2010
Posts: 87
Default

im not sure how to successfully use .bin for picture containers.

if u use a folder to store the images, then there is no need to set resources.

height = screen.height()
width= screen.width()
black = color.new(0,0,0)
screen.fillrect(0,0,width,height,black)
screen.update()
--image.setresource("Pic.bin")

PlateauAll = image.load("Pic/PlateauAll.png")
PlateauAll:draw(0,0,width,height)
screen.update()

while 1 do
if control.read()==1 then
if (control.isButton() == 1) then
break
end
else os.sleep(10)
end
end

PlateauAll:close()

Last edited by JJLoke; 03-04-2010 at 08:06 AM.
Reply With Quote

  #5  
Old 03-04-2010, 08:15 AM
nipico nipico is offline
Junior Member
 
Join Date: Feb 2010
Posts: 43
Default

i delete the set ressource and then the problem still exist
but i try to modify x,y and it works so i put again x,y for full screen and it works

I don't understand but i used to have a problem
thx
Reply With Quote

  #6  
Old 03-04-2010, 09:55 AM
nipico nipico is offline
Junior Member
 
Join Date: Feb 2010
Posts: 43
Default

I've got another question.
Sometimes i've got '<eof>' expected near 'end'
What does it mean?
thx
Reply With Quote

  #7  
Old 03-04-2010, 11:30 AM
Brett_val's Avatar
Brett_val Brett_val is offline
Senior Member
 
Join Date: Jan 2010
Location: The Netherlands
Posts: 636
Default

Quote:
Originally Posted by nipico View Post
sorry but i don't see the spelling error
As regards bin i must say image.setresource("Pic"). Is that it?
thx
Quote:
Originally Posted by nipico View Post
i delete the set ressource and then the problem still exist
but i try to modify x,y and it works so i put again x,y for full screen and it works

I don't understand but i used to have a problem
thx
It is because it said

PlateauAll:draw(0,0,widht,height)
instead of
PlateauAll:draw(0,0,width,height)

You see the difference in the spelling of "width" ?

I also make that mistake a lot, "phkey" instead of "hpkey" and then I'm wondering why it doesn't work
Reply With Quote

  #8  
Old 03-04-2010, 12:02 PM
nipico nipico is offline
Junior Member
 
Join Date: Feb 2010
Posts: 43
Default

thank you Brett_val and xConStruct for all
bye
Reply With Quote

  #9  
Old 03-04-2010, 06:41 PM
Brett_val's Avatar
Brett_val Brett_val is offline
Senior Member
 
Join Date: Jan 2010
Location: The Netherlands
Posts: 636
Default

Haha I just had it again..

"why does it give me errors..?"
*puts "print()" everywhere*
"why does it print 'nil' everytime...?"

and after close inspection, I typed "lenght" somewhere instead of "length" :P
Reply With Quote

  #10  
Old 03-04-2010, 07:16 PM
ThievingSix ThievingSix is offline
Member
 
Join Date: Aug 2008
Posts: 218
Default

Dyslexia ftw!
__________________
Only ONE more functions in the Wiki need addressing!
Zen X-Fi2 LUA Wiki
Want to protect your applications? Click Here!
Tower Defense Thread
Zen Lock - Protect Your Zen!
Reply With Quote

  #11  
Old 03-05-2010, 04:48 AM
JJLoke JJLoke is offline
Junior Member
 
Join Date: Jan 2010
Posts: 87
Default

tts strange ... i posted a working code in my post but he seems to missed it
Reply With Quote

  #12  
Old 04-22-2010, 02:26 PM
Roubloodshed Roubloodshed is offline
Junior Member
 
Join Date: Feb 2010
Posts: 1
Default Show an image ... -_-"

Hi everyone !
I start to create a "software", but I have a problem ( an important problem ! lol ).
I don' t know how to show a picture on the screen T.T
One day I tried in a game for PSP, but I don' t know, I can' t do that on ZEN -_-" ...

So if someone could tell me the code to show a picture on ZEN, tell me please .
I think it' s not important, but the picture I want to show is the background of the application.

I just started like that :

Code:
-- Images

image_bg = image.load:("images/background.png");
After it doesn' t work ...

Please help me ^^
If a topic already exist about that I' m sorry but I didn' t find it :/

Thank you for all,
Bye .
Reply With Quote

  #13  
Old 04-22-2010, 02:46 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

There have been other people asking about this, I'll merge this into a thread I remember about this. There's only two pages of threads so far, it shouldn't take long to go through both to see if there is a similar topic (I just did).

Also the answer is that you first load your picture as you did (without the : ), then you have to draw it to the screen. But to see the image you have to catch it in a loop also, otherwise it'll exit the program instantly:

Code:
image_bg = image.load("images/background.png")

width = screen.width() --Saves screen width
height = screen.height() --Saves screen height

image_bg:draw(0,0,width,height)
screen.update()

while(true) do --eternal loop
    if(control.read() == 1 and control.isTouch() == 1) then --if the screen is touched
          break --break the loop
     end
end

image_bg:close()
that code draws an image and exit when you press the screen (Unless I typoed something :P)
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^

Last edited by Habhome; 04-22-2010 at 02:55 PM.
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 05:23 PM.