import sys, os
from panda3d.core import load_prc_file, DirectionalLight, AmbientLight, VBase4, Vec3, Point3
from direct.gui.OnscreenImage import OnscreenImage
load_prc_file('config.prc')
from city import City
from helper import base, pedestrian_spawnpoints, CITY_SIZE, PAUSED, PARTICLES
loading_screen = OnscreenImage('img/loading.png', parent=base.aspect2d, scale=(1.778, 0, 1))
base.graphics_engine.renderFrame()
base.graphics_engine.renderFrame()
base.graphics_engine.renderFrame()
base.graphics_engine.renderFrame()

print("lights")

base.set_background_color(0, 0, 0, 1)
base.disable_mouse()
base.camLens.set_near(2)

amblight = AmbientLight('ambli')
amblight.set_color(VBase4(0.2, 0.2, 0.2, 0.2))
ambnp = base.render.attach_new_node(amblight)
base.render.set_light(ambnp)

light = DirectionalLight('amblight')
light.set_color(VBase4(1, 0.863, 0.451, 1))
lnp = base.render.attach_new_node(light)
lnp.set_p(-50)
base.render.set_light(lnp)
if PARTICLES:
    base.enable_particles()

print("genning city")

City(CITY_SIZE)
print("player import")
from people.player import instance as player
print("camera")
base.camera.set_pos(0, 0, 20)
base.camera.look_at(20, 20, 0)
import sound_manager
import ui

import pedestrian_spawner
import police_spawner
print("action")

loading_screen.remove_node()
base.run()
print("exiting")