Page 5 of 25

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Sun Oct 10, 2010 11:37 pm
by kikito
I'm pleased to announce that the specs phase on middleclass is over.

I've just finished doing what I hope will be the last important change on the library, and entering bug-fixing mode.

This means that middleclass has reached v1.0.

The other important news I have is that Mindstate has moved to a separate package: middleclass-extras. She is not alone now. Some items that previously were inside PÄSSION will now make her company - I'm talking about Beholder, GetterSetter, Sender, and Callbacks.

middleclass-extras is *not* v1.0 just yet, but it shouldn't take long. It has tests, and they all pass. I'm just one mixin short - I'm going to call it Apply. I will put the 'apply this to all instances of this class' methods that currently are hardcoded on PÄSSION's Actor class inside this mixin, so they can be shared (Notably, Timers and Cameras would use them).

I'm eager to integrate middleclass-extras with PÄSSION! I'm hoping to do it this week, since I have one day off.

So, if any of you was hesitant about using a 'non-finished' library for object orientation, you don't have any excuse now. Just go grab it!

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Mon Oct 11, 2010 7:23 am
by giniu
kikito wrote:This means that middleclass has reached v1.0.
Congratulations on reaching 1.0 :D

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Mon Oct 11, 2010 12:48 pm
by kikito
Why, thanks! :ultraglee:

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Mon Oct 11, 2010 8:31 pm
by TechnoCat
I guess it is about time for me to try out this library. Looks like it will become essential to my toolbox.

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Tue Oct 12, 2010 6:20 pm
by kikito
That would be great. I'll appreciate any feedback or comments!

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Tue Oct 12, 2010 11:55 pm
by TylertheDesigner
Does Middleclass and middleclass extras work outside of the Love Engine? It seems there is no direct connection to the LOVE API in the code, but I am a noob and may have missed something.

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Wed Oct 13, 2010 12:23 am
by TechnoCat
TylertheDesigner wrote:Does Middleclass and middleclass extras work outside of the Love Engine? It seems there is no direct connection to the LOVE API in the code, but I am a noob and may have missed something.
I believe it is just a Lua library.

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Wed Oct 13, 2010 6:34 am
by kikito
TylertheDesigner wrote:Does Middleclass and middleclass extras work outside of the Love Engine? It seems there is no direct connection to the LOVE API in the code, but I am a noob and may have missed something.
Hi TyletheDesigner!

All the libraries on this forum thread are completely LÖVE-independant. You can use them on any engine that accepts Lua.

Regards!

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Sun Oct 17, 2010 6:43 pm
by TechnoCat
I have run into a problem.
Whenever I try to call a class function it crashes.

I have two classes: Server and Game.
Server creates a new game object inside itself. (and this is where I think the problem lies, I am not sure if it creates a global or a class variable.)

Then I override the love.update and love.draw functions. It crashes whenever they try to call Game:update() and Game:draw() inside the callbacks. How do I reference the game object correctly? Or, if the problem lies elsewhere, what is incorrect?

server.lua:

Code: Select all

local Server = NetTest:addState('Server')
function Server:enterState()
  clearLoveCallbacks()
  --TODO: SERVER INIT CODE
  game = Game:new()
  function love.update(dt)
    --TODO: SERVER NETWORK CODE
    game:update(dt) --THIS CAUSES A REFERENCE NIL ERROR
  end
  function love.draw()
    game:draw() --THIS CAUSES A REFERENCE NIL ERROR
  end
end
function Server:exitState()
  --TODO: SERVER EXIT CODE
end
game.lua:

Code: Select all

Game = class("Game", StatefulObject)
function Game:initialize()
  
end

--[[Update]]
function Game:update(dt)

end

--[[Draw]]
function Game:draw()
  
end

Re: middleclass & middleclass-extras: Object Orientation for

Posted: Sun Oct 17, 2010 11:57 pm
by kikito
I'm browsing the site from my mobile and won't be able to give this a look until tomorrow evening.

Is have never used Lube.

Is that how it is supposed to work, redefining the love callbacks, org is that your own invention?