Page 5 of 9

Re: ËNVY (LÖVE Framework)

Posted: Wed Nov 26, 2008 1:07 am
by Kuromeku
I done did made my own GUI library for ËNVY.

Code: Select all

	LOL_PANEL = envy.control.add("panel");
	LOL_PANEL:setPosition( envy.vector:new(256, 256) );
	LOL_PANEL:setSize(256, 256);
	
	LOL_PANEL2 = envy.control.add("button");
	LOL_PANEL2:setSize(512, 256)
	LOL_PANEL2:setCallback(function() envy.console.print("cock") end)
	LOL_PANEL2:setParent(LOL_PANEL)
	LOL_PANEL2:setColor(255, 50, 50, 255);
	LOL_PANEL2:setPosition( envy.vector:new(8, 8) );
	LOL_PANEL2:getLabel():setText("HAI GUYZ")
	LOL_PANEL2:sizeToContents()
	LOL_PANEL:sizeToContents()
Works beautifully.

Re: ËNVY (LÖVE Framework)

Posted: Wed Nov 26, 2008 12:32 pm
by Borsty
That's like exactly how lgui works :V

Re: ËNVY (LÖVE Framework)

Posted: Wed Nov 26, 2008 1:34 pm
by Kuromeku
This is the first time I've ever attempted networking in my life :O

SERVER:

Code: Select all

function GAME:sendEntities(ip)
	for k, v in pairs(envy.entity.spawned) do
		self.server:send("entity", ip);
			self.server:send("x:"..v:getX(), ip);
			self.server:send("y:"..v:getY(), ip);
			self.server:send("a:"..v:getAngle(), ip);
			self.server:send("c:"..v:getClass(), ip);
		self.server:send("entity", ip);
	end;
end;
CLIENT:

Code: Select all

function GAME.onNetworkReceive(data, ip, port)
	if (data == "entity") then
		if (GAME.currentEntity) then
			if (not GAME.currentEntity.index) then
				local entity = envy.entity.add(GAME.currentEntity.class);
				
				-- Set some information about the entity.
				entity:setPosition( envy.vector:new(GAME.currentEntity.x, GAME.currentEntity.y) );
				entity:setAngle(GAME.currentEntity.angle);
				entity:spawn();
			elseif ( envy.entity.spawned[GAME.currentEntity.index] ) then
				if (GAME.currentEntity.x) then
					envy.entity.spawned[GAME.currentEntity.index]:setX(GAME.currentEntity.x);
				end;
				if (GAME.currentEntity.y) then
					envy.entity.spawned[GAME.currentEntity.index]:setY(GAME.currentEntity.y);
				end;
				if (GAME.currentEntity.angle) then
					envy.entity.spawned[GAME.currentEntity.index]:setAngle(GAME.currentEntity.angle);
				end;
			end;
			
			-- Set the current entity table to nil.
			GAME.currentEntity = nil;
		else
			GAME.currentEntity = {};
		end;
	elseif (GAME.currentEntity) then
		if (string.sub(data, 1, 2) == "x:") then
			GAME.currentEntity.x = tonumber( string.sub(data, 3) );
		elseif (string.sub(data, 1, 2) == "y:") then
			GAME.currentEntity.y = tonumber( string.sub(data, 3) );
		elseif (string.sub(data, 1, 2) == "a:") then
			GAME.currentEntity.angle = tonumber( string.sub(data, 3) );
		elseif (string.sub(data, 1, 2) == "c:") then
			GAME.currentEntity.class = string.sub(data, 3);
		elseif (string.sub(data, 1, 2) == "i:") then
			GAME.currentEntity.index = tonumber( string.sub(data, 3) );
		end;
	end;
end;
Image

Re: ËNVY (LÖVE Framework)

Posted: Wed Nov 26, 2008 1:44 pm
by 1stAnd10
This is fantastic, thanks for all your hard work on this.

When is version 11 going to get posted so I can play with GUI stuff? ;)

*bangs on table for more*

Re: ËNVY (LÖVE Framework)

Posted: Wed Nov 26, 2008 2:18 pm
by Kuromeku
The network stuff won't be ready till like PHASE 22 or something, I want it to be really good, and I want to wait until LUBE is ready.

And as for the GUI stuff, me and Borsty are working on a little something at the moment and then I'll release it soon.

Re: ËNVY (LÖVE Framework)

Posted: Wed Nov 26, 2008 5:32 pm
by 1stAnd10
Thanks for the update. :)

Re: ËNVY (LÖVE Framework)

Posted: Wed Nov 26, 2008 10:27 pm
by qubodup
Hehe, apparently Kudomiku is as hyperactive as he is, because he wants to reserve all the cool names for his projects ;)

Re: ËNVY (LÖVE Framework)

Posted: Thu Nov 27, 2008 1:12 am
by Borsty
Meh, can't be arsed to upload it somewhere so I'll post it here xD
For increasing the trace-lib's performance I was working on a line - quadtree today. Here's what it looks like when it's processing the boxes xD

Re: ËNVY (LÖVE Framework)

Posted: Thu Nov 27, 2008 11:56 am
by Kuromeku
Image

Version: Phase 11.
Download: http://kudomiku.com/dump/lua/envy/envy.love.
Changelog:

Code: Select all

[Phase 11]
   * Added envy.util.getSound and envy.util.newMusic and envy.util.getImage.
   * Added envy.util.isBetween(value, minimum, maximum).
   * Added envy.vector.class:angleBetween(vector).
   * Added envy.vector.class:moveTowards(angle, speed).
   * Added envy.vector.class:moveAtAngle(angle, speed).
   * Added envy.vector.class:rotate(angle).
   * Added envy.entity.class:addVelocity(velocity) (adds to the entity's velocity).
   * Added envy.entity.include(file).
   * Added envy.entity.includeAll(directory).
   * Added envy.control.include(file).
   * Added envy.control.includeAll(directory).
   * Added envy.util.enumerate(directory);
   * Added envy.util.include(file);
   * Added envy.trace.class:setName(name).
   * Added envy.trace.class:getName().
   * Added envy.util.reverseTable(base).
   * Added anything in game/entities/ is included automatically.
   * Added anything in game/controls/ is included automatically.
   * Added if you return true on a GAME hook, the normal hooks will not run.
   * Added if you return true on a hook, the rest of the hooks will not run.
   * Added canTraceHit hook for entities (return false to disallow the trace to hit it).
   * Added onInitialize hook for entities.
   * Added onHookError hook.
   * Added canPressKey and canPressMouse hooks (return false to disallow).
   * Added onDrawControls hook.
   * Added the envy.control library.
   * Added the envy.module library.
   * Changed onMousePressed and onMouseReleased arguments to (button, position).
   * Changed the way entities work you no longer need to define ENTITY and register it in the file. This is done automatically
when it is included.
Delete your current ËNVY installation before installing the new one! You don't need to delete your game folder!

Re: ËNVY (LÖVE Framework)

Posted: Thu Nov 27, 2008 12:38 pm
by 1stAnd10
Kudomiku do you have a function in ENVY that returns the dot product? If not that could be really useful. I'm just starting out with vector math and one thing XNA had was a math.dot function that I used a lot. I can live without it but just a suggestion while your adding other useful stuff.