From 8ce09138d2bf2ba08768b8c616524434d918f769 Mon Sep 17 00:00:00 2001 From: Frank DeMarco Date: Mon, 6 Apr 2020 02:08:55 -0400 Subject: [PATCH] framebuffer display option added --- pgfw/Configuration.py | 3 ++- pgfw/Game.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pgfw/Configuration.py b/pgfw/Configuration.py index e09264e..7b59cf5 100644 --- a/pgfw/Configuration.py +++ b/pgfw/Configuration.py @@ -85,6 +85,7 @@ class Configuration(RawConfigParser): set_option(section, "framerate-text-size", "16", False) set_option(section, "framerate-text-color", "0, 0, 0", False) set_option(section, "framerate-text-background", "255, 255, 255", False) + set_option(section, "use-framebuffer", "no", False) section = "input" add_section(section) set_option(section, "release-suffix", "-release", False) @@ -401,7 +402,7 @@ class TypeDeclarations(dict): "framerate-text-size"], "bool": ["centered", "skip-frames", "fullscreen", - "show-framerate"], + "show-framerate", "use-framebuffer"], "int-list": ["dimensions", "framerate-text-color", "framerate-text-background"]}, diff --git a/pgfw/Game.py b/pgfw/Game.py index eaf61ea..c6eac81 100644 --- a/pgfw/Game.py +++ b/pgfw/Game.py @@ -1,4 +1,4 @@ -import pygame +import os, pygame from pygame.locals import * from .Animation import Animation @@ -26,6 +26,10 @@ class Game(Animation): self.config_rel_path = config_rel_path self.type_declarations = type_declarations self.set_configuration() + if self.get_configuration("display", "use-framebuffer"): + os.putenv("SDL_FBDEV", "/dev/fb0") + os.putenv("SDL_VIDEODRIVER", "fbcon") + os.putenv("SDL_NOMOUSE", "1") pygame.init() self.set_children() self.subscribe(self.end, QUIT)