middleclass & extras: middleclass 3.0 is out!

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: middleclass & middleclass-extras: Object Orientation for

Post 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!
Last edited by kikito on Mon Oct 11, 2010 8:29 am, edited 1 time in total.
When I write def I mean function.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: middleclass & middleclass-extras: Object Orientation for

Post by kikito »

Why, thanks! :ultraglee:
When I write def I mean function.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: middleclass & middleclass-extras: Object Orientation for

Post by TechnoCat »

I guess it is about time for me to try out this library. Looks like it will become essential to my toolbox.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: middleclass & middleclass-extras: Object Orientation for

Post by kikito »

That would be great. I'll appreciate any feedback or comments!
When I write def I mean function.
User avatar
TylertheDesigner
Citizen
Posts: 80
Joined: Sat Apr 10, 2010 2:27 am

Re: middleclass & middleclass-extras: Object Orientation for

Post 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.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: middleclass & middleclass-extras: Object Orientation for

Post 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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: middleclass & middleclass-extras: Object Orientation for

Post 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!
When I write def I mean function.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: middleclass & middleclass-extras: Object Orientation for

Post 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
Attachments
learnLUBE.love
learnLUBE 0.7.0
(12.82 KiB) Downloaded 155 times
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: middleclass & middleclass-extras: Object Orientation for

Post 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?
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests