12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- # 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
- # GTK module ( Graphical interface
- import gi
- gi.require_version('Gtk', '3.0')
- from gi.repository import Gtk
- import cairo
- from modules import ui
- 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)
-
-
- # Text settings
- layer.select_font_face("Monospace",
- cairo.FONT_SLANT_NORMAL,
- cairo.FONT_WEIGHT_NORMAL)
- current_fontoption = layer.get_font_options()
- current_fontoption.set_antialias(cairo.ANTIALIAS_NONE)
- layer.set_font_options(current_fontoption)
-
-
- # The FPS meter
- ui.color(game, layer, "#FFFFFF")
- ui.text(game, layer, "FPS: "+str(game.FPS), 5, 5 )
- ui.text(game, layer, "AFPS: "+str(game.AFPS),
- game.current["w"]-5, 5, align="right")
- # The keys
- ui.text(game, layer, str(game.current["keys"]),
- int(game.current["w"]/2), game.current["h"] - 15,
- align="center")
- # Mouse Visualization thingy
- for n ,button in enumerate(["LMB", "MMB", "RMB"]):
-
- if game.current[button]:
- # Each mouse line it's own color
- ui.color(game, layer, "red")
- if button == "MMB":
- ui.color(game, layer, "green")
- elif button == "RMB":
- ui.color(game, layer, "bright_blue")
-
- layer.move_to(game.current[button][0],
- game.current[button][1])
- layer.line_to(game.current["mx"],
- game.current["my"])
- layer.stroke()
-
- return surface
|