Changing the Tutorial Example code

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
RussHubs
Prole
Posts: 6
Joined: Thu Apr 07, 2011 12:15 pm

Changing the Tutorial Example code

Post 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
Last edited by RussHubs on Thu Apr 07, 2011 2:17 pm, edited 3 times in total.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Changing the Tutorial Example code

Post 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
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Changing the Tutorial Example code

Post by Lafolie »

I'm feeling generous so I'll spare you with this link man:

http://love2d.org/wiki
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Changing the Tutorial Example code

Post 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
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Changing the Tutorial Example code

Post 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:
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Changing the Tutorial Example code

Post 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.
RussHubs
Prole
Posts: 6
Joined: Thu Apr 07, 2011 12:15 pm

Re: Changing the Tutorial Example code

Post 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.
RussHubs
Prole
Posts: 6
Joined: Thu Apr 07, 2011 12:15 pm

Re: Changing the Tutorial Example code

Post 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
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Changing the Tutorial Example code

Post 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.
Kurosuke needs beta testers
Post Reply

Who is online

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