from pygame import image, Color

from esp_hadouken.GameChild import *
from esp_hadouken.Font import *

class Score(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.pos = self.get_configuration()["ending-plate-position"]
        self.set_plate()

    def set_plate(self):
        path = self.get_resource("ending-plate-path")
        self.plate = image.load(path).convert_alpha()

    def render_score(self):
        config = self.get_configuration()
        color = Color(config["ending-score-color"])
        size = config["ending-score-size"]
        score = Font(self, size).render(self.build_text(), True, color)
        rect = score.get_rect()
        rect.center = self.plate.get_rect().center
        self.plate.blit(score, rect)

    def build_text(self):
        return "%i:%02i" % divmod(int(self.get_timer().total()), 60)

    def update(self):
        if self.active:
            self.set_plate()
            self.render_score()
            self.draw()

    def draw(self):
        self.parent.blit(self.plate, self.pos)

    def activate(self):
        self.active = True

    def deactivate(self):
        self.active = False
from pygame import Surface, Color
from pygame.locals import *

from esp_hadouken.GameChild import *
from Cell import *

class NamePrompt(GameChild, Surface):

    cell_count = 3
    transparent_color = Color("brown")

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.init_surface()
        self.subscribe_to_events()
        self.add_cells()
        self.deactivate()

    def init_surface(self):
        size = self.get_configuration()["scoreboard-prompt-dimensions"]
        Surface.__init__(self, size)
        self.set_transparent()
        rect = self.get_rect()
        rect.center = self.parent.get_rect().center
        self.rect = rect

    def set_transparent(self):
        color = self.transparent_color
        self.set_colorkey(color)
        self.fill(color)

    def subscribe_to_events(self):
        self.subscribe_to(KEYDOWN, self.respond_to_key)

    def respond_to_key(self, event):
        if self.active:
            key = event.key
            if key >= K_a and key <= K_z:
                self.get_active_cell().set_char(key)
                self.change_active_cell(1)
                self.parent.update()
            elif key == K_BACKSPACE:
                if self.get_active_cell().is_blank():
                    self.change_active_cell(-1)
                self.get_active_cell().reset()
                self.parent.update()

    def get_active_cell(self):
        return self.cells[self.active_cell_index]

    def change_active_cell(self, increment):
        limit = len(self.cells) - 1
        index = self.active_cell_index + increment
        if index > limit:
            index = limit
        elif index < 0:
            index = 0
        self.active_cell_index = index

    def add_cells(self):
        cells = []
        for ii in range(self.cell_count):
            cells.append(Cell(self, ii))
        self.cells = cells
        self.active_cell_index = 0

    def activate(self):
        self.active = True

    def deactivate(self):
        self.active = False

    def update(self):
        if self.active:
            self.draw()

    def draw(self):
        self.parent.blit(self, self.rect)

    def get_initials(self):
        return "".join(map(str, self.cells))
from pygame import Surface, Color
from pygame.locals import *

from esp_hadouken.GameChild import *
from esp_hadouken.Font import *

class Cell(GameChild, Surface):

    def __init__(self, parent, index):
        GameChild.__init__(self, parent)
        self.index = index
        self.init_surface()
        self.reset()

    def __str__(self):
        return chr(self.char).upper()

    def init_surface(self):
        size = self.get_configuration()["scoreboard-prompt-dimensions"]
        margin = self.get_margin()
        width = size[0] / self.parent.cell_count - margin
        Surface.__init__(self, (width, size[1]))
        rect = self.get_rect()
        rect.left = (self.get_width() + margin) * self.index + margin / 2
        self.rect = rect

    def get_margin(self):
        return self.get_configuration()["scoreboard-prompt-margin"]

    def reset(self):
        self.set_char(self.get_blank_char())

    def get_blank_char(self):
        return ord(self.get_configuration()["scoreboard-prompt-blank-char"])

    def set_char(self, char):
        self.char = char
        self.set_color()
        self.draw()

    def set_color(self):
        char = self.char
        if char == self.get_blank_char():
            color = Color(
                self.get_configuration()["scoreboard-prompt-blank-color"])
        else:
            color = self.get_glyph_palette()[char - K_a]
        self.color = color

    def activate(self):
        self.active = True

    def deactivate(self):
        self.active = False

    def draw(self):
        self.fill(self.color)
        self.render_char()
        self.parent.blit(self, self.rect)

    def render_char(self):
        config = self.get_configuration()
        size = config["scoreboard-prompt-text-size"]
        color = Color(config["scoreboard-prompt-text-color"])
        text = Font(self, size).render(str(self), True, color)
        rect = text.get_rect()
        rect.center = self.get_rect().center
        self.blit(text, rect)

    def is_blank(self):
        return self.char == self.get_blank_char()
18.222.20.30
18.222.20.30
18.222.20.30
 
December 3, 2013

Where in the mind's prism does light shine, inward, outward, or backward, and where in a plane does it intersect, experientially and literally, while possessing itself in a dripping wet phantasm?


Fig 1.1 What happens after you turn on a video game and before it appears?

The taxonomy of fun contains the difference between gasps of desperation and exaltation, simultaneously identical and opposite; one inspires you to have sex, while the other to ejaculate perpetually. A destruction and its procession are effervescent, while free play is an inseminated shimmer hatching inside you. Unlikely to be resolved, however, in such a way, are the climaxes of transitions between isolated, consecutive game states.

You walk through a door or long-jump face first (your face, not Mario's) into a painting. A moment passes for eternity, viscerally fading from your ego, corpus, chakra, gaia, the basis of your soul. It happens when you kill too, and especially when you precisely maim or obliterate something. It's a reason to live, a replicating stasis.


Fig 1.2 Sequence in a video game

Video games are death reanimated. You recurse through the underworld toward an illusion. Everything in a decision and logic attaches permanently to your fingerprint. At the core, you use its energy to soar, comatose, back into the biosphere, possibly because the formal structure of a mind by human standards is useful in the next world.