Skip to content

Commit

Permalink
Added colors.
Browse files Browse the repository at this point in the history
  • Loading branch information
James King committed Aug 27, 2013
1 parent d28d3fa commit 972b88c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion installer
@@ -1,4 +1,4 @@
local REPO_URL = "http://yevano.me/omegle-cc/"
local REPO_URL = "https://raw.github.com/Yevano/omegle-cc/master/"
local SUPPORTS_COLOR = term.isColor()

local MAKE_PATHS = {
Expand Down
33 changes: 31 additions & 2 deletions me/yevano/omegle/client/OmegleClient.lua
Expand Up @@ -3,6 +3,7 @@
--@import see.net.Http
--@import see.concurrent.ThreadPool
--@import see.io.Terminal
--@import see.util.Color

function OmegleClient.main(args)
local threadPool = ThreadPool.new()
Expand All @@ -11,6 +12,10 @@ function OmegleClient.main(args)
local typing = false
local connectionHook

if Terminal.isColor() then
Terminal.setFG(Color.PURPLE)
end

if session.commonLikes then
local intString = String.new()
if session.commonLikes:length() > 0 then
Expand All @@ -31,11 +36,21 @@ function OmegleClient.main(args)
if event then
if event.type == OmegleSession.EVENT_MESSAGE then
Terminal.clearLine()
System.print(STR("Stranger: ", event.message))
if Terminal.isColor() then
Terminal.setFG(Color.RED)
System.write("Stranger: ")
Terminal.setFG(Color.YELLOW)
else
System.write("Stranger: ")
end
System.print(event.message)
drawInput(typing, sendString)
elseif event.type == OmegleSession.EVENT_TYPING then
typing = not typing
elseif event.type == OmegleSession.EVENT_DISCONNECTED then
if Terminal.isColor() then
Terminal.setFG(Color.PURPLE)
end
System.print("Stranger disconnected.")
connected = false
Hooks.remove(connectionHook)
Expand All @@ -52,7 +67,14 @@ function OmegleClient.main(args)
Hooks.add("key", function(k)
if k == 28 then
session:send(sendString)
System.print(STR("You: ", sendString))
if Terminal.isColor() then
Terminal.setFG(Color.BLUE)
System.write("You: ")
Terminal.setFG(Color.YELLOW)
else
System.write("You: ")
end
System.print(sendString)
sendString = String.new()
drawInput(typing, sendString)
elseif k == 14 then
Expand All @@ -62,6 +84,9 @@ function OmegleClient.main(args)
elseif k == 157 then
connected = false
session:disconnect()
if Terminal.isColor() then
Terminal.setFG(Color.PURPLE)
end
System.print("You have disconnected.")
end
end)
Expand All @@ -72,6 +97,10 @@ function OmegleClient.main(args)
end

function drawInput(typing, message)
if Terminal.isColor() then
Terminal.setFG(Color.WHITE)
end

local pos = Terminal.getPos()
local size = Terminal.getSize()
Terminal.setPos(1, size.y)
Expand Down
10 changes: 5 additions & 5 deletions omegle-cc.sublime-workspace
Expand Up @@ -531,7 +531,7 @@
"file": "me/yevano/omegle/client/OmegleClient.lua",
"settings":
{
"buffer_size": 2671,
"buffer_size": 2835,
"line_ending": "Windows"
}
},
Expand Down Expand Up @@ -933,15 +933,15 @@
"file": "me/yevano/omegle/client/OmegleClient.lua",
"settings":
{
"buffer_size": 2671,
"buffer_size": 2835,
"regions":
{
},
"selection":
[
[
139,
139
1880,
1880
]
],
"settings":
Expand All @@ -951,7 +951,7 @@
"translate_tabs_to_spaces": true
},
"translation.x": 0.0,
"translation.y": 0.0,
"translation.y": 450.0,
"zoom_level": 1.0
},
"type": "text"
Expand Down

0 comments on commit 972b88c

Please sign in to comment.