Page 1 of 1

Changing the Tutorial Example code

Posted: Thu Apr 07, 2011 1:37 pm
by RussHubs
Hi Everyone,

OK, so I have my 800x600 window with hello world written in white against a black background, made using the following code:

Code: Select all

function love.draw()
    love.graphics.print('Hello World!', 400, 300)
end
Now I have some questions, I'll try to edit this thread as I get more

1, Can you have a flash movie play in that screen? ~ On some games, theres alittle Nvidia splash screen thats played or an ATI 1, maybe an intel or an AMD splash screen might play too, then they tend to goto a menu screen, what format are these 'movies' made in?


2, How do I change that game window in a fullscreen window? ~ Solved
nevon wrote: You can either set t.fullscreen to true in your conf.lua, or you can use love.graphics.toggleFullscreen
3, If I have my conf.lua file set to fullscreen = true, how do I position the 'hello world' text, down 10% from the top and 10% in from the left, or down 10% from the top and centered?

Regards

Re: Changing the Tutorial Example code

Posted: Thu Apr 07, 2011 1:44 pm
by nevon
RussHubs wrote:1, How do I play a flash movie in that window so the hello world message appears when the flash movie as finished playing?
You can't. Löve has no video playback, and I know of no game development frameworks that allow you to play flash files.
RussHubs wrote:2, How do I change that game window in a fullscreen window?
You can either set t.fullscreen to true in your conf.lua, or you can use love.graphics.toggleFullscreen

Re: Changing the Tutorial Example code

Posted: Thu Apr 07, 2011 1:48 pm
by Lafolie
I'm feeling generous so I'll spare you with this link man:

http://love2d.org/wiki

Re: Changing the Tutorial Example code

Posted: Thu Apr 07, 2011 1:52 pm
by bartbes
nevon wrote: You can't. Löve has no video playback, and I know of no game development frameworks that allow you to play flash files.
I know, flash! :P

Re: Changing the Tutorial Example code

Posted: Thu Apr 07, 2011 1:57 pm
by nevon
bartbes wrote:
nevon wrote: You can't. Löve has no video playback, and I know of no game development frameworks that allow you to play flash files.
I know, flash! :P
Herp derp. :monocle:

Re: Changing the Tutorial Example code

Posted: Thu Apr 07, 2011 1:58 pm
by nevon
RussHubs wrote:On some games, theres alittle Nvidia splash screen thats played or an ATI 1, maybe an intel or an AMD splash screen might play too, then they tend to goto a menu screen, what format are these 'movies' made in?
No, idea. But it doesn't matter, since Löve can't play any video formats whatsoever. That said, you can fake it by using images and fade them in and out or whatever it is you want to do.

Re: Changing the Tutorial Example code

Posted: Thu Apr 07, 2011 2:00 pm
by RussHubs
Lafolie wrote:I'm feeling generous so I'll spare you with this link man:

http://love2d.org/wiki
Thanks fella, I'm looking through it now, but it's still alittle complex for me, would also like to ask a question and get an answer kind of thing lol.

You never know someone else might explain things in a way even I can understand.

Re: Changing the Tutorial Example code

Posted: Thu Apr 07, 2011 2:04 pm
by RussHubs
nevon wrote:
RussHubs wrote:On some games, theres alittle Nvidia splash screen thats played or an ATI 1, maybe an intel or an AMD splash screen might play too, then they tend to goto a menu screen, what format are these 'movies' made in?
No, idea. But it doesn't matter, since Löve can't play any video formats whatsoever. That said, you can fake it by using images and fade them in and out or whatever it is you want to do.

Ok using the code in the OP, how do I display pic1.png then pic2.png for 5 seconds each, say, they are in my 'Game' folder in the GFX/Splash folder

Re: Changing the Tutorial Example code

Posted: Thu Apr 07, 2011 9:02 pm
by tentus
Things you will need:

1) Images loaded. You can do that like this:

Code: Select all

function love.load() 
  img = love.graphics.newImage("GFX/Splash/pic1.png")
  img2 = love.graphics.newImage("GFX/Splash/pic2.png")
end
2) Some way of keeping track of time. I like to just use dt like this:

Code: Select all

function love.load() 
  img = love.graphics.newImage("GFX/Splash/pic1.png")
  img2 = love.graphics.newImage("GFX/Splash/pic2.png")
  timecount = 0
end

function love.update(dt) 
  timecount = timecount + dt
end
3) The images displayed

Code: Select all

function love.load() 
  img = love.graphics.newImage("GFX/Splash/pic1.png")
  img2 = love.graphics.newImage("GFX/Splash/pic2.png")
  timecount = 0
end

function love.update(dt) 
  timecount = timecount + dt
end

function love.draw()
  if timecount < 5 then
    love.graphics.draw(img, 0, 0)
  else
    love.graphics.draw(img2, 0, 0)
  end
end
Lastly you may want to do something clever to make the images fade. Keep in mind that there isn't one single way to do all this, there are many ways.