Need Help! (Images + Filesystem)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Robotboy655
Prole
Posts: 2
Joined: Sat Mar 06, 2010 3:04 pm

Need Help! (Images + Filesystem)

Post by Robotboy655 »

Hello!

I have some questions about drawing images and filesystem.

I have trouble with drawing resized 1600x1200 image (Making background for a game), when i drawing the image via this code:

Code: Select all

local bg = love.graphics.newImage("background01.jpg")
love.graphics.draw(bg,0,0,0,love.graphics.getWidth() / bg:getWidth(),love.graphics.getHeight() / bg:getHeight(),0,0)
the game have less then 10 fps. Any ideas how to fix that?

About the filesystem: I already know how to write and read files, but i need somehow write files into the root folder of a .love/.exe (or even into the .love/.exe file) and i have no idea how to do that. Can anyone help me?
User avatar
kalle2990
Party member
Posts: 245
Joined: Sat Sep 12, 2009 1:17 pm
Location: Sweden

Re: Need Help! (Images + Filesystem)

Post by kalle2990 »

Don't load the image in love.draw, that will cause the game to slow down quite much. Do it in love.load instead :)

Code: Select all

function love.load()
   bg = love.graphics.newImage("background01.jpg")
end

function love.draw()
   love.graphics.draw(bg,0,0,0,love.graphics.getWidth() / bg:getWidth(),love.graphics.getHeight() / bg:getHeight(),0,0)
end
Robotboy655 wrote:About the filesystem: I already know how to write and read files, but i need somehow write files into the root folder of a .love/.exe (or even into the .love/.exe file) and i have no idea how to do that. Can anyone help me?
That is not possible, and will never be (I think)... :? If you can explain what you're using it for I should be able to find another way of doing it though ^^
Robotboy655
Prole
Posts: 2
Joined: Sat Mar 06, 2010 3:04 pm

Re: Need Help! (Images + Filesystem)

Post by Robotboy655 »

Thank you! No lag now :D
About the filesystem: I want to create a config file, where i will save the screen resolution, and other stuff, to carry it over sessions.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Need Help! (Images + Filesystem)

Post by Robin »

Robotboy655 wrote:Thank you! No lag now :D
About the filesystem: I want to create a config file, where i will save the screen resolution, and other stuff, to carry it over sessions.
Saving to conf.lua should work, I think. If not, just say t.screen = false in conf.lua, and do a setMode() with values loaded from your config file in love.load().
Help us help you: attach a .love.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Need Help! (Images + Filesystem)

Post by Jasoco »

Löve is sandboxed. i.e. it has access to the filesystem in a limited fashion so as to not allow destruction of important system files. By giving each game its own subfolder to play around in, it can create and destroy files on a whim without causing problems. Sadly since the sandbox is saved per user, you will not be able to save sessions across users. i.e. save files that all users can access. The other users will have to create the files again for each one when they run the game.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests