-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
98 lines (78 loc) · 2.99 KB
/
main.lua
File metadata and controls
98 lines (78 loc) · 2.99 KB
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
io.stdout:setvbuf('no')
function love.load()
screen = {L = love.graphics.getWidth(), H = love.graphics.getHeight()}
mouse = {x=0 , y = 0}
require('utils/vecteur2')
require("utils/constantes")
require("utils/animation")
require("utils/geometry")
require("pannelescape")
require("shader")
mGui = require("utils/gui")
camera = require("utils/camera")
--******************************************************************************************************
-- SONS - MUSIQUES - IMAGES
require("utils/sfx")
music_man = require("utils/music_manager")
--require("utils/assets") -- CHARGE TOUTES LES ASSETS IMAGES SONS MUSIQUES (dans le music_manager) FONTS
--*******************************************************************************************************
--ON CHARGE LE CURSEUR DU JEU ET SES IMAGES
require("utils/cursor")
myCursor = createClassicCursor()
myCursor.addCursor("open","assets/images/curseur/cursor_up.png" )
myCursor.addCursor("close","assets/images/curseur/cursor_down.png" )
--*******************************************************************************************************
-- ON CHARGE LE SCENES_MANAGER
scene_man = require("scenes/scene_manager")
-- LA VARIABLE CURRENT SCENE CONTIENT LA SCENE ACTIVE
love.mouse.setVisible(false)
scene_man.current_scene = scene_man.list["loading"]
scene_manager.current_scene.load()
end
function love.update(dt)
dt = math.min(dt , 0.017)
mouse.x,mouse.y = love.mouse.getX(), love.mouse.getY()
myCursor.setCursor("open")
music_man.update(dt)
scene_man.current_scene.update(dt)
--*****************************************************************************************
-- CHANGEMENT DE SCENE : FADE OUT
if scene_man.next_scene ~= nil then
scene_man.fade_out_in(scene_man.next_scene,dt)
end
--******************************************************************************************
if camera.shake then
camera.onShake(dt)
end
if love.mouse.isDown(1) then
myCursor.setCursor("close")
end
end
function love.draw()
-- la camera dessine la scene courante
camera.drawScene(scene_man.current_scene)
--*****************************************************************************************
-- CHANGEMENT DE SCENE : FADE OUT
if scene_man.next_scene ~=nil then
love.graphics.setColor(0,0,0,scene_man.alpha)
love.graphics.draw(fondNoir,0,0)
end
--******************************************************************************************
end
function love.keypressed(key)
scene_man.current_scene.keypressed(key)
end
function love.mousepressed(x,y, button)
scene_man.current_scene.mousepressed(x,y,button)
end
function love.mousereleased(x,y,button)
scene_man.current_scene.mousereleased(x,y,button)
end
function love.focus(focus)
end
function love.textinput(txt)
scene_man.current_scene.textinput(txt)
end
function love.quit()
scene_man.current_scene.quit()
end