Page 3 of 3

Re: LÖVE 0.6.2

Posted: Mon Mar 08, 2010 12:06 am
by Jasoco
Ah yes. That takes me back to my days with TNT Basic and QuickBASIC when I used to do the same thing.

Re: LÖVE 0.6.2

Posted: Mon Mar 08, 2010 12:47 am
by smartazz
rude wrote:smartazz: In LevelTileset.lua:166
Thank you rude, much appreciated :) Probably have to update the tutorials in the wiki too ;)

Re: LÖVE 0.6.2

Posted: Fri Apr 16, 2010 4:52 am
by devyn
kikito wrote:Yipee!
devyn wrote: But it isn't. As you can see, the line on the right has disappeared suddenly in 0.6.2. In 0.6.1, the whole rectangle displays correctly.
Devyn, I think that what Bartbes means is that on 0.6.1 the rectangle dimensions was wrong.

Your rectangle probably "got around this" and calculated the dimensions so it looked "good". But it was not "correct".

Can you paste the code you are using?
Sorry, I was taking a break from game development for a while. Anyway, here's the full "window.lua". I'm still having issues with it.

Code: Select all

-- Working on the windows for GUI. -Timothy
-- Made Window into a class, and made it draw =D

Window = {}

function Window.new(args)

   local i = {
      position = {0, 0},
      color = {255, 255, 255, 255},
      caption = "PLACE HOLDER",
      size = {500, 500},
      draw = Window._draw,
      update = Window._update,
      mousedown = Window._mousedown,
      mouseup = Window._mouseup,
      content_draw = function (self)
		     end,
      content_update = function (self, dt)
		       end,
      content = {},
      mo = {0, 0},
      ontarget = false
   }

   if args.color then
      i.color = args.color
   end

   if args.position then
      i.position = args.position
   end

   if args.size then
      i.size = args.size
   end

   if args.caption then
      i.caption = args.caption
   end

   return i
end

function Window._dragNdrop(x, y, sizex, sizey)

   sizex = sizex + x
   sizey = sizey + y

   if love.mouse.getX() >= x and love.mouse.getX() <= sizex and
      love.mouse.getY() >= y and love.mouse.getY() <= sizey then
      --
      return true
   end
   
end

function Window:_update(dt)

   local mp = {love.mouse.getPosition()}

   if self.ontarget then
      self.position[1], self.position[2] = mp[1]+self.mo[1], mp[2]+self.mo[2]
   end

   self:content_update(dt)

end

function Window:_draw()

   self.headerSize = {self.size[1], 24}
   self.headerPosition = {self.position[1], self.position[2] - self.headerSize[2]}
   
   love.graphics.setLineWidth(2)
   love.graphics.setLineStyle('smooth')

   love.graphics.setColor(unpack(self.color))
   love.graphics.rectangle("line", self.headerPosition[1], self.headerPosition[2], self.headerSize[1], self.headerSize[2])
   love.graphics.setColor(0,0,0,255)
   love.graphics.rectangle("fill", self.headerPosition[1], self.headerPosition[2], self.headerSize[1], self.headerSize[2])
   love.graphics.setColor(unpack(self.color))
   love.graphics.rectangle("line", self.position[1], self.position[2], self.size[1], self.size[2])
   love.graphics.rectangle("fill", self.position[1], self.position[2], self.size[1], self.size[2])

   love.graphics.setColor(255,255,255,255)
   love.graphics.print(self.caption, self.headerPosition[1]+8, self.headerPosition[2]+15)

   self:content_draw()
   
end

function Window:_mousedown(x, y, button)
   if button == 'l'
         and x >= self.headerPosition[1]
         and y >= self.headerPosition[2]
         and x <= self.headerPosition[1]+self.headerSize[1]
         and y <= self.headerPosition[2]+self.headerSize[2] then
      self.mo = {self.position[1]-x, self.position[2]-y}
      self.ontarget = true
   end
end

function Window:_mouseup(x, y, button)
   if button == 'l' and self.ontarget then self.ontarget = false end
end
Edit: and now I see my problem. LOL. Thanks, I guess I just needed to look at it again.