aboutsummaryrefslogtreecommitdiffstats
path: root/GUI/InGame.lua
blob: 190889418c5134c79f3e57e488bafeb0e0ec1ac2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
local InGame = {}

InGame.Polygons = {}

InGame.Colors = { {255, 0, 0, 255}, {255, 128, 0, 255}, {255, 255, 0, 255}, {0, 255, 0, 255}, {128, 128, 128, 255}, {255, 255, 255, 255} }

function InGame.drawPolygon(polygon)
	if polygon.Colors then
		love.graphics.setColor(unpack(polygon.Colors))
	end

	if polygon.LineWidth then
		love.graphics.setLineWidth(polygon.LineWidth*(Screen.width+Screen.height)/2)
	end

	if polygon.Type == "rectangle" then
		love.graphics.rectangle(polygon.DrawMode, polygon.Position.x*Screen.width, polygon.Position.y*Screen.height,
			polygon.Dimension.width*Screen.width, polygon.Dimension.height*Screen.height)

	elseif polygon.Type == "polygon" then
		love.graphics.polygon(polygon.DrawMode, polygon.Position.x1*Screen.width, polygon.Position.y1*Screen.height,
			polygon.Position.x2*Screen.width, polygon.Position.y2*Screen.height,
			polygon.Position.x3*Screen.width, polygon.Position.y3*Screen.height,
			polygon.Position.x4*Screen.width, polygon.Position.y4*Screen.height)

	elseif polygon.Type == "line" then
		love.graphics.line(polygon.Position.x1*Screen.width, polygon.Position.y1*Screen.height,
			polygon.Position.x2*Screen.width, polygon.Position.y2*Screen.height)
	elseif polygon.Type == "print" then
		love.graphics.print(polygon.Text, polygon.Position.x*Screen.width, polygon.Position.y*Screen.height)
	end
end

function InGame.loadInterface()
	love.graphics.setBackgroundColor(0, 0, 0)

	-- Inner Window border
	table.insert(InGame.Polygons, { Type = "rectangle", DrawMode = "line", LineWidth = 0.005, Position = { x = 0.005, y = 0.005}, Dimension = {width = 0.99, height = 0.99}, Colors = {0, 0, 171, 255} })

	-- Background
	for i = 0, 5 do
		table.insert(InGame.Polygons, { Type = "polygon", DrawMode = "fill", Position = { x1 = 0.01, y1 = 0.02+0.02*i, x2 = 0.02+0.02*i, y2 = 0.01, x3 = 0.03+0.02*i, y3 = 0.01, x4 = 0.01, y4 = 0.03+0.02*i}, Colors = {0, 0, 171, 255} })
		table.insert(InGame.Polygons, { Type = "polygon", DrawMode = "fill", Position = { x1 = 0.99, y1 = 0.98-0.02*i, x2 = 0.98-0.02*i, y2 = 0.99, x3 = 0.97-0.02*i, y3 = 0.99, x4 = 0.99, y4 = 0.97-0.02*i}, Colors = {0, 0, 171, 255} })
	end

	-- Left box
	table.insert(InGame.Polygons, { Type = "rectangle", DrawMode = "fill", Position = { x = 0.05, y = 0.05}, Dimension = {width = 0.35, height = 0.90}, Colors = {0, 0, 0, 255} })
	table.insert(InGame.Polygons, { Type = "rectangle", DrawMode = "line", Position = { x = 0.05, y = 0.05}, Dimension = {width = 0.35, height = 0.90}, Colors = {0, 0, 171, 255} })
	table.insert(InGame.Polygons, { Type = "line", Position = { x1 = 0.05, y1 = 0.1, x2 = 0.4, y2 = 0.1}, Colors = {0, 0, 171, 255} })

	-- Left box buttons
	table.insert(InGame.Polygons, { Type = "rectangle", DrawMode = "line", Position = { x = 0.075, y = 0.875}, Dimension = {width = 0.125, height = 0.05}, Colors = {0, 0, 171, 255} })
	table.insert(InGame.Polygons, { Type = "rectangle", DrawMode = "line", Position = { x = 0.25, y = 0.875}, Dimension = {width = 0.125, height = 0.05}, Colors = {0, 0, 171, 255} })
	
	-- Left box content
	table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.01, Position = { x1 = 0.375, y1 = 0.15-0.005, x2 = 0.375, y2 = 0.75}, Colors = {0, 0, 171, 255} })
	
	-- Right top box
	table.insert(InGame.Polygons, { Type = "rectangle", LineWidth = 0.005, DrawMode = "line", Position = { x = 0.45, y = 0.05}, Dimension = {width = 0.50, height = 0.75}, Colors = {0, 0, 171, 255} })
	table.insert(InGame.Polygons, { Type = "line", Position = { x1 = 0.45, y1 = 0.1, x2 = 0.95, y2 = 0.1}, Colors = {0, 0, 171, 255} })

	-- Right top box content
	table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.01, Position = { x1 = 0.375-0.0025, y1 = 0.75, x2 = 0.52+5*0.075+0.0025, y2 = 0.75}, Colors = {0, 0, 171, 255} })
	table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.01, Position = { x1 = 0.475, y1 = 0.75, x2 = 0.475, y2 = 0.15-0.0025}, Colors = {0, 0, 171, 255} })
	table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.01, Position = { x1 = 0.9, y1 = 0.15-0.0025, x2 = 0.9, y2 = 0.7}, Colors = {0, 0, 171, 255} })
	table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.03, Position = { x1 = 0.795, y1 = 0.7-0.01, x2 = 0.9+0.005, y2 = 0.7-0.01}, Colors = {0, 0, 171, 255} })
	table.insert(InGame.Polygons, { Type = "rectangle", LineWidth = 0.01, DrawMode = "line", Position = { x = 0.52, y = 0.66}, Dimension = {width = 0.275, height = 0.05}, Colors = {0, 0, 171, 255} })
	
	for j = 0, 6	do
		table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.005, Position = { x1 = 0.77, y1 = 0.15+j*0.075, x2 = 0.785, y2 = 0.15+j*0.075}, Colors = {0, 0, 171, 255} })
		table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.005, Position = { x1 = 0.785, y1 = 0.1275+j*0.075-0.0005, x2 = 0.785, y2 = 0.1725+j*0.075+0.0005}, Colors = {0, 0, 171, 255} })
		table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.005, Position = { x1 = 0.86, y1 = 0.1275+j*0.075, x2 = 0.86, y2 = 0.1725+j*0.075}, Colors = {0, 0, 171, 255} })
		table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.005, Position = { x1 = 0.86, y1 = 0.15+j*0.075, x2 = 0.9, y2 = 0.15+j*0.075}, Colors = {0, 0, 171, 255} })
		
		for i = 0, 3	do
			table.insert(InGame.Polygons, { Type = "rectangle", LineWidth = 0.01, DrawMode = "line", Position = { x = 0.497+i*0.075, y = 0.12+j*0.075}, Dimension = {width = 0.045, height = 0.05}, Colors = {0, 0, 171, 255} })
			table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.01, Position = { x1 = 0.471+i*0.075, y1 = 0.15+j*0.075, x2 = 0.497+i*0.075, y2 = 0.15+j*0.075}, Colors = {0, 0, 171, 255} })
		end
		
		for k = 0, 1	do
			for l = 0, 1	do
				table.insert(InGame.Polygons, { Type = "rectangle", LineWidth = 0.0025, DrawMode = "line", Position = { x = 0.795+k*0.0325, y = 0.12+l*0.0325+j*0.075}, Dimension = {width = 0.0225, height = 0.025}, Colors = {0, 0, 171, 255} })
			end
			
			for m = 0, 2	do
				table.insert(InGame.Polygons, { Type = "line", LineWidth = 0.0025, Position = { x1 = 0.785+m*0.0325, y1 = 0.1275+k*0.045+j*0.075, x2 = 0.795+m*0.0325, y2 = 0.1275+k*0.045+j*0.075}, Colors = {0, 0, 171, 255} })
			end
		end
	end
	
	-- Right bottom box
	table.insert(InGame.Polygons, { Type = "rectangle", LineWidth = 0.005, DrawMode = "fill", Position = { x = 0.45, y = 0.85}, Dimension = {width = 0.50, height = 0.10}, Colors = {0, 0, 0, 255} })
	table.insert(InGame.Polygons, { Type = "rectangle", DrawMode = "line", Position = { x = 0.45, y = 0.85}, Dimension = {width = 0.50, height = 0.10}, Colors = {0, 0, 171, 255} })

	-- Right bottom box buttons
	for i = 0, 5 do
		table.insert(InGame.Polygons, { Type = "rectangle", DrawMode = "fill", Position = { x = 0.50+i*0.075, y = 0.875}, Dimension = {width = 0.04, height = 0.04}, Colors = InGame.Colors[i+1] })
		table.insert(InGame.Polygons, { Type = "rectangle", DrawMode = "line", LineWidth = 0.01, Position = { x = 0.50+i*0.075, y = 0.875}, Dimension = {width = 0.04, height = 0.04}, Colors = {0, 0, 171, 255} })
		table.insert(InGame.Polygons, { Type = "line", Position = { x1 = 0.52+i*0.075, y1 = 0.75, x2 = 0.52+i*0.075, y2 = 0.875}, Colors = {0, 0, 171, 255} })
		if i < 5 then
			table.insert(InGame.Polygons, { Type = "line", Position = { x1 = 0.5+i*0.075+0.04, y1 = 0.895, x2 = 0.52+(i+1)*0.075, y2 = 0.895}, Colors = {0, 0, 171, 255} })
		end
	end
end

return InGame