hg = require "harfang"
font_garamond = "assets/fonts/eb-garamond-regular.ttf"
screen_clock = 0.0

hg.LoadPlugins()
hg.MountFileDriver(hg.StdFileDriver())

plus = hg.GetPlus()
plus:RenderInit(1280, 720, 4)

scn = plus:NewScene()

scn:Load('assets/3d/level_title.scn', plus:GetRenderSystem())

function drawTitleScreenMessage(dt)

	function fade_sin(fade)
		return (math.cos(fade * 3.0) + 1.0) * 0.5
	end

	dt_sec = 1.0 / 60.0

	size = {x = 1280, y = 720 } -- plus:GetRenderer():GetCurrentOutputWindow():GetSize()
	x = size.x * 0.5 - 100.0
	y = size.y * 0.5 - 210.0
	font_size = 80
	screen_clock = screen_clock + dt_sec

	plus:Text2D(x - size.x * 0.001, y - size.y * 0.001, "Press Enter", font_size, hg.Color(0,0,0, fade_sin(screen_clock) * 0.5), font_garamond)
	plus:Text2D(x, y, "Press Enter", font_size, hg.Color(1,1,1, fade_sin(screen_clock)), font_garamond)

	y = y - 40
	plus:Text2D(300, y - 20.0, "The MedieCross Project 2010-2015, made for TigSource.com.", 30, hg.Color.Black, font_garamond)
	plus:Text2D(350, y - 50.0, "Code : Emmanuel Julien - Art : Francois Gutherz", 30, hg.Color.Black, font_garamond)
	plus:Text2D(360, y - 80.0, "Animation : Ryan Hagen - Engine : Harfang3D", 30, hg.Color.Black, font_garamond)
end

while not plus:IsAppEnded() do
	dt = plus:UpdateClock()

	plus:UpdateScene(scn, dt)
	drawTitleScreenMessage(dt)
	-- plus:Text2D(5, 5, "Move around with QSZD, left mouse button to look around")
	plus:Flip()
end
