<commit_before>import os

import pyglet
from pyglet.gl import *
from pyglet import info

import pygame
from pygame.locals import *

from Common import logger, log_level, COMMAND


class GameBackend:
    enable_font = False
    enable_keyboard = False
    enable_mouse = False

    def __init__(self, core_manager):
        self.running = False
        self.valid = False
        self.core_manager = core_manager

    def set_window_title(self, title):
        raise BaseException('You muse implement.')

    def change_resolution(self, width=0, height=0, full_screen=False):
        raise BaseException('You muse implement.')

    def run(self):
        raise BaseException('You muse implement.')

    def on_resize(self, width, height):
        raise BaseException('You muse implement.')

    def on_draw(self, *args):
        raise BaseException('You muse implement.')

    def flip(self):
        raise BaseException('You muse implement.')

    def quit(self):
        raise BaseException('You muse implement.')


class PyGlet(pyglet.window.Window, GameBackend):
    enable_font = True
    enable_keyboard = True
    enable_mouse = True

    def __init__(self, core_manager):
        GameBackend.__init__(self, core_manager)

        os.environ['PYGLET_DEBUG_GL'] = '1'
        config = Config(double_buffer=True, )
        # Ubuntu Vsync Off : NVidia X Server Setting -> OpenGL Setting -> Sync To VBlank ( Off )
        pyglet.window.Window.__init__(self, width=512, height=512, config=config, resizable=True, vsync=False)

        # for debbug
        # self.push_handlers(pyglet.window.event.WindowEventLogger())

        # show system info
        # pyglet.info.dump()

        self.valid = True

    def set_window_title(self, title):
        self.set_caption(title)

    def change_resolution(self, width=0, height=0, full_screen=False):
        self.set_size(width, height)<commit_msg>Game Backend<commit_after>import os

import pyglet
from pyglet.gl import *
from pyglet import info

import pygame
from pygame.locals import *

from Common import logger, log_level, COMMAND


class GameBackend:
    enable_font = False
    enable_keyboard = False
    enable_mouse = False

    def __init__(self, core_manager):
        self.running = False
        self.valid = False
        self.core_manager = core_manager

    def set_window_title(self, title):
        raise BaseException('You muse implement.')

    def change_resolution(self, width=0, height=0, full_screen=False):
        raise BaseException('You muse implement.')

    def run(self):
        raise BaseException('You muse implement.')

    def on_resize(self, width, height):
        raise BaseException('You muse implement.')

    def on_draw(self, *args):
        raise BaseException('You muse implement.')

    def flip(self):
        raise BaseException('You muse implement.')

    def quit(self):
        raise BaseException('You muse implement.')


class PyGlet(pyglet.window.Window, GameBackend):
    enable_font = False
    enable_keyboard = False
    enable_mouse = False

    def __init__(self, core_manager):
        GameBackend.__init__(self, core_manager)

        os.environ['PYGLET_DEBUG_GL'] = '1'
        config = Config(double_buffer=True, )
        # Ubuntu Vsync Off : NVidia X Server Setting -> OpenGL Setting -> Sync To VBlank ( Off )
        pyglet.window.Window.__init__(self, width=512, height=512, config=config, resizable=True, vsync=False)

        # for debbug
        # self.push_handlers(pyglet.window.event.WindowEventLogger())

        # show system info
        # pyglet.info.dump()

        self.valid = True

    def set_window_title(self, title):
        self.set_caption(title)

    def change_resolution(self, width=0, height=0, full_screen=False):
        self.set_size(width, height)
{'fraction_non_alphanumeric': 0.09546413502109705, 'fraction_numerical': 0.0058016877637130804, 'mean_word_length': 3.069742489270386, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7203422', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1111, 'n_words': 290}