mirror of https://github.com/teverse/teverse
Compare commits
No commits in common. "2e92d94a9f70396fa5695db89b057583619e3e24" and "1e4e1af8a99d7b17091ff8a4fd93cb0c3fa4891c" have entirely different histories.
2e92d94a9f
...
1e4e1af8a9
|
@ -1,74 +1,4 @@
|
||||||
-- Copyright 2020- Teverse.com
|
local function newFeedItem(pfp, name, date, body)
|
||||||
-- Used to display the home screen of the teverse application
|
|
||||||
|
|
||||||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
|
||||||
|
|
||||||
local function createFlair(parent, data)
|
|
||||||
local username = parent:child("username").text
|
|
||||||
if data then
|
|
||||||
local flairCount = 0
|
|
||||||
|
|
||||||
-- Beta(Tester) Insignia
|
|
||||||
if data.postedBy.beta == true then
|
|
||||||
teverse.construct("guiIcon", {
|
|
||||||
parent = parent:child("username"),
|
|
||||||
size = guiCoord(0, 10, 0, 10),
|
|
||||||
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
|
||||||
iconType = "faSolid",
|
|
||||||
iconId = "flask",
|
|
||||||
iconColour = colour.rgb(220, 53, 69),
|
|
||||||
})
|
|
||||||
flairCount = flairCount + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Plus Membership Insignia
|
|
||||||
if data.postedBy.membership == "plus" then
|
|
||||||
teverse.construct("guiIcon", {
|
|
||||||
parent = parent:child("username"),
|
|
||||||
size = guiCoord(0, 10, 0, 10),
|
|
||||||
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
|
||||||
iconType = "faSolid",
|
|
||||||
iconId = "thermometer-empty",
|
|
||||||
iconColour = globals.defaultColours.primary
|
|
||||||
})
|
|
||||||
flairCount = flairCount + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Pro Membership Insignia
|
|
||||||
if data.postedBy.membership == "pro" then
|
|
||||||
teverse.construct("guiIcon", {
|
|
||||||
parent = parent:child("username"),
|
|
||||||
size = guiCoord(0, 10, 0, 10),
|
|
||||||
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
|
||||||
iconType = "faSolid",
|
|
||||||
iconId = "thermometer-full",
|
|
||||||
iconColour = globals.defaultColours.purple
|
|
||||||
})
|
|
||||||
parent:child("username").textColour = globals.defaultColours.purple
|
|
||||||
parent:child("body").textColour = globals.defaultColours.purple
|
|
||||||
flairCount = flairCount + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Mod/Staff Insignia
|
|
||||||
--[[
|
|
||||||
if then
|
|
||||||
teverse.construct("guiIcon", {
|
|
||||||
parent = parent:child("username"),
|
|
||||||
size = guiCoord(0, 10, 0, 10),
|
|
||||||
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
|
||||||
iconType = "faSolid",
|
|
||||||
iconId = "shield-alt",
|
|
||||||
iconColour = globals.defaultColours.blue
|
|
||||||
})
|
|
||||||
parent:child("username").textColour = globals.defaultColours.blue
|
|
||||||
parent:child("body").textColour = globals.defaultColours.blue
|
|
||||||
flairCount = flairCount + 1
|
|
||||||
end
|
|
||||||
]]--
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function newFeedItem(date, data)
|
|
||||||
local item = teverse.construct("guiFrame", {
|
local item = teverse.construct("guiFrame", {
|
||||||
size = guiCoord(1, -20, 0, 48),
|
size = guiCoord(1, -20, 0, 48),
|
||||||
position = guiCoord(0, 10, 0, 40),
|
position = guiCoord(0, 10, 0, 40),
|
||||||
|
@ -80,19 +10,19 @@ local function newFeedItem(date, data)
|
||||||
name = "profilePicture",
|
name = "profilePicture",
|
||||||
size = guiCoord(0, 30, 0, 30),
|
size = guiCoord(0, 30, 0, 30),
|
||||||
position = guiCoord(0, 0, 0, 5),
|
position = guiCoord(0, 0, 0, 5),
|
||||||
image = "tevurl:asset/user/"..(data.postedBy.id),
|
image = pfp,
|
||||||
parent = item,
|
parent = item,
|
||||||
strokeRadius = 15,
|
strokeRadius = 15,
|
||||||
strokeAlpha = 0.04
|
strokeAlpha = 0.04
|
||||||
})
|
})
|
||||||
|
|
||||||
local username = teverse.construct("guiTextBox", {
|
local name = teverse.construct("guiTextBox", {
|
||||||
name = "username",
|
name = "username",
|
||||||
size = guiCoord(1, -40, 0, 20),
|
size = guiCoord(1, -40, 0, 20),
|
||||||
position = guiCoord(0, 40, 0, 3),
|
position = guiCoord(0, 40, 0, 3),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
parent = item,
|
parent = item,
|
||||||
text = data.postedBy.username,
|
text = name,
|
||||||
textSize = 20,
|
textSize = 20,
|
||||||
textAlpha = 0.6,
|
textAlpha = 0.6,
|
||||||
textFont = "tevurl:fonts/openSansBold.ttf"
|
textFont = "tevurl:fonts/openSansBold.ttf"
|
||||||
|
@ -117,14 +47,12 @@ local function newFeedItem(date, data)
|
||||||
position = guiCoord(0, 40, 0, 22),
|
position = guiCoord(0, 40, 0, 22),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
parent = item,
|
parent = item,
|
||||||
text = data.message,
|
text = body,
|
||||||
textWrap = true,
|
textWrap = true,
|
||||||
textAlign = enums.align.topLeft,
|
textAlign = enums.align.topLeft,
|
||||||
textSize = 16,
|
textSize = 16
|
||||||
})
|
})
|
||||||
|
|
||||||
createFlair(item, data)
|
|
||||||
|
|
||||||
return item
|
return item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -381,9 +309,9 @@ return {
|
||||||
}, function(code, body)
|
}, function(code, body)
|
||||||
if code == 200 then
|
if code == 200 then
|
||||||
lastRefresh = os.clock()
|
lastRefresh = os.clock()
|
||||||
local data = teverse.json:decode(body)
|
local json = teverse.json:decode(body)
|
||||||
if #data > 0 then
|
if #json > 0 then
|
||||||
if data[1].id == newestFeed then
|
if json[1].id == newestFeed then
|
||||||
-- no change from last refresh
|
-- no change from last refresh
|
||||||
return nil
|
return nil
|
||||||
else
|
else
|
||||||
|
@ -394,11 +322,11 @@ return {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
newestFeed = data[1].id
|
newestFeed = json[1].id
|
||||||
local y = 50
|
local y = 50
|
||||||
for _,v in pairs(data) do
|
for _,v in pairs(json) do
|
||||||
local date = os.date("%d/%m/%Y %H:%M", os.parseISO8601(v.postedAt))
|
local date = os.date("%d/%m/%Y %H:%M", os.parseISO8601(v.postedAt))
|
||||||
local item = newFeedItem(date, v)
|
local item = newFeedItem("tevurl:asset/user/" .. v.postedBy.id, v.postedBy.username, date, v.message)
|
||||||
item.parent = feedItems
|
item.parent = feedItems
|
||||||
local dy = item:child("body").textDimensions.y
|
local dy = item:child("body").textDimensions.y
|
||||||
item.size = guiCoord(1, -20, 0, dy + 28)
|
item.size = guiCoord(1, -20, 0, dy + 28)
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
$input v_color0
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_FragColor = v_color0;
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
vec4 v_color0 : COLOR0 = vec4(1.0, 1.0, 1.0, 1.0);
|
|
||||||
vec3 a_position : POSITION;
|
|
||||||
vec4 a_color0 : COLOR0;
|
|
|
@ -1,8 +0,0 @@
|
||||||
$input a_position, a_color0
|
|
||||||
$output v_color0
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0));
|
|
||||||
v_color0 = a_color0;
|
|
||||||
}
|
|
Loading…
Reference in New Issue