# THIS IS A SOURCE CODE FILE FROM I'M NOT EVEN HUMAN THE GAME.
# IT COULD BE USED IN A DIFFERENT PIECE OF SOFTWARE ( LIKE A
# DIFFERENT GAME ), BUT IT WAS ORIGINALLY WRITTEN FOR I'M NOT
# EVEN HUMAN THE GAME.

# THE DEVELOPERS OF THE GAME ARE : (C) J.Y.AMIHUD, AYYZEE AND 
# OTHER CONTRIBUTORS. THIS AND OTHER FILES IN THIS GAME,
# UNLESS SPECIFICALLY NOTED, COULD BE USED UNDER THE TERMS OF
# GNU GENERAL PUBLIC LICENSE VERSION 3 OR ANY LATER VERSION.

import os
import json

# GTK module ( Graphical interface
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import cairo

from modules import ui
from modules import world

def layer(game):

    # Setting up a cairo layer
    surface = cairo.ImageSurface(cairo.FORMAT_ARGB32,
                                 game.current['w'],
                                 game.current['h'])
    layer = cairo.Context(surface)
    layer.set_antialias(cairo.ANTIALIAS_NONE)


    
    ui.color(game, layer, "#FFFFFF")
    ui.text(game, layer, game.worlds[game.settings["world"]]["title"],
            int(game.current["w"]/2), 5,
            align="center")

    world.draw(game, layer, 20, 20,
               game.current["w"]-30,
               game.current["h"]-50, grid=True)
    
    return surface
