Here is where it is called.
Code: Select all
function load( ip, name, r, g, b)
-- Collider = HC( 100, on_collision )
cam = camera(vector(256, 208), 1)
love.graphics.setBackgroundColor( 50, 50, 50 )
love.graphics.setColor( r, g, b)
client = lube.client()
client:setHandshake("chillout")
client:setCallback(onReceive)
client:connect(ip, 18025) --82.24.82.156 marks
client:send( "name" .. name)
end
Here is where the user inputs the variables... (Is there any easier way to add a form?)
Code: Select all
local name = ""
local ip = ""
local r = ""
local g = ""
local b = ""
local flag = 1
function love.draw()
love.graphics.print("ip: " .. ip, 10, 10)
love.graphics.print("name: " .. name, 10, 30 )
love.graphics.print("Red: " .. r, 10, 50)
love.graphics.print("Green: " .. g, 10, 70)
love.graphics.print("Blue: " .. b, 10, 90)
end
function love.keypressed( key )
if key == 'return' then
if flag == 1 then
flag = 2
elseif flag == 2 then
flag = 3
elseif flag == 3 then
flag = 4
elseif flag == 4 then
flag = 5
elseif flag == 5 then
playing( ip, name, r, g, b )
end
elseif key == 'backspace' then
if flag == 1 then
ip = string.sub(ip, 1, string.len( ip ) - 1)
elseif flag == 2 then
name = string.sub(name , 1, string.len( name ) - 1)
elseif flag == 3 then
r = string.sub(r , 1, string.len( r ) - 1)
elseif flag == 4 then
g = string.sub(g , 1, string.len( g ) - 1)
elseif flag == 5 then
b = string.sub(b , 1, string.len( b ) - 1)
end
else
if flag == 1 then
ip = ip .. key
elseif flag == 2 then
name = name .. key
elseif flag == 3 then
r = r .. key
elseif flag == 4 then
g = g .. key
elseif flag == 5 then
b = b .. key
end
end
end