API questions

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.
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: API questions

Post by Santos »

Neat, thanks! :)

Code: Select all

function love.load()
  imagedata = love.image.newImageData('image.png')
  width, height = imagedata:getDimensions()

  compressed = love.math.compress(imagedata, 'gzip')
  filedata = love.filesystem.newFileData(compressed:getString(), '')
  decompressed = love.math.decompress(filedata, 'gzip')

  imagedata = love.image.newImageData(width, height, decompressed)
  image = love.graphics.newImage(imagedata)
end

function love.draw()
  love.graphics.draw(image)
end
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: API questions

Post by Santos »

So this is probably an SDL thing and maybe a "my computer is just weird" thing, but when I press this laptop's Fn key and press the function keys, I get unexpected results from love.keypressed.

For example, when I press Fn and F1 (which is mute), I get the key "d" (the scancodes are the same as the keys for all of these). It doesn't output the letter "d" in other applications though. Volume down and up are "c" and "b", numlock and scrolllock are as expected, display switch is "lgui" and search is "f14".

So uh, is this normal?
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: API questions

Post by slime »

Weird. I've never heard of that before - but it's not something love's code can really affect, in any case. (It'd be up to either SDL or the operating system APIs that SDL calls).
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: API questions

Post by Santos »

Weird indeed, thanks slime.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: API questions

Post by Nixola »

I have a similar bug on Linux, except it affects everything and the key is never released, meaning that it leads to stuff like ddddddddddddd typed all over what I'm doing.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 48 guests