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: 383
Joined: Sat Oct 22, 2011 7:37 am

Re: API questions

Post by Santos » Fri Sep 22, 2017 12:46 pm

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: 383
Joined: Sat Oct 22, 2011 7:37 am

Re: API questions

Post by Santos » Mon Sep 25, 2017 12:00 pm

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: 2887
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: API questions

Post by slime » Mon Sep 25, 2017 1:26 pm

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: 383
Joined: Sat Oct 22, 2011 7:37 am

Re: API questions

Post by Santos » Mon Sep 25, 2017 2:02 pm

Weird indeed, thanks slime.

User avatar
Nixola
Inner party member
Posts: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: API questions

Post by Nixola » Mon Sep 25, 2017 5:54 pm

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], zorg and 37 guests