from pygame import Surface

from dark_stew.pgfw.GameChild import GameChild
from dark_stew.water.Layer import Layer

class Water(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.display_surface = self.get_display_surface()
        self.load_configuration()
        self.set_background()
        self.add_layers()

    def load_configuration(self):
        config = self.get_configuration("water")
        self.opacity = config["opacity"]
        self.speed = config["speed"]
        self.color = config["color"]

    def set_background(self):
        background = Surface(self.display_surface.get_size())
        background.fill(self.color)
        self.background = background

    def add_layers(self):
        layers = []
        for ii, opacity in enumerate(self.opacity):
            layers.append(Layer(self, opacity, self.speed[ii], ii * 16))
        self.layers = layers

    def update(self):
        for layer in self.layers:
            layer.update()
        self.draw()

    def draw(self):
        self.display_surface.blit(self.background, (0, 0))
        for layer in reversed(self.layers):
            layer.draw()
from pygame import Surface
from pygame.image import load

from dark_stew.pgfw.GameChild import GameChild

class Layer(GameChild, Surface):

    def __init__(self, parent, opacity, speed, base_offset):
        GameChild.__init__(self, parent)
        self.opacity = opacity
        self.speed = speed
        self.base_offset = base_offset
        self.display_surface = self.get_display_surface()
        self.transparent_color = (255, 0, 255)
        self.offset = 0
        self.set_tile()
        self.init_surface()
        self.paint()

    def set_tile(self):
        path = self.get_resource("water", "tile-path")
        self.tile = load(path).convert_alpha()

    def init_surface(self):
        padding = self.tile.get_width()
        width, height = self.parent.parent.size
        Surface.__init__(self, (width + padding, height + padding))
        transparent_color = self.transparent_color
        self.fill(transparent_color)
        self.set_colorkey(transparent_color)
        self.set_alpha(self.opacity)
        self.padding = padding

    def paint(self):
        tile = self.tile
        for x in xrange(0, self.get_width(), tile.get_width()):
            for y in xrange(0, self.get_height(), tile.get_height()):
                self.blit(tile, (x, y))

    def update(self):
        offset = self.offset - self.speed
        padding = self.padding
        if offset < -padding:
            offset += padding
        self.offset = offset

    def draw(self):
        rect = self.parent.parent.move([int(self.offset)] * 2)
        rect.top += self.base_offset
        self.display_surface.blit(self, rect)
from math import sqrt
from os import listdir
from os.path import isdir, join
from re import match

from dark_stew.pgfw.GameChild import GameChild
from dark_stew.pool.Pool import Pool

class Pools(GameChild, list):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.add_pools()

    def add_pools(self):
        width = self.parent.w
        step = int(float(width) / sqrt(self.count_pools()))
        ii = 0
        for x in xrange(step / 2, width, step):
            for y in xrange(step / 2, width, step):
                self.append(Pool(self, (x, y), ii))
                ii += 1
        self.step = step

    def count_pools(self):
        count = 0
        root = self.get_resource("pool", "water-path")
        for name in listdir(root):
            if match("^[0-9]", name):
                count += 1
        return count

    def update(self):
        for pool in self:
            pool.update()
from os.path import join

from dark_stew.pgfw.Sprite import Sprite

class Ring(Sprite):

    def __init__(self, parent, index):
        Sprite.__init__(self, parent)
        self.index = index
        self.display_surface = self.get_display_surface()
        self.load_from_path(self.build_path(), transparency=True, ppa=False)
        self.rect.center = parent.center

    def build_path(self):
        return join(self.get_resource("pool", "ring-path"),
                    str(self.index) + ".png")

    def draw(self):
        x, y = self.rect.topleft
        frame = self.get_current_frame()
        surface = self.display_surface
        for dx, dy in self.parent.parent.parent.get_corners():
            surface.blit(frame, (x + dx, y + dy))
from os.path import join

from pygame import Surface
from pygame.image import load

from dark_stew.pgfw.Sprite import Sprite

class Water(Sprite):

    def __init__(self, parent, index):
        Sprite.__init__(self, parent)
        self.index = index
        self.display_surface = self.get_display_surface()
        self.transparent_color = (255, 0, 255)
        self.load_configuration()
        self.load_groove()
        self.set_framerate(self.framerate)
        self.load_from_path(join(self.frames_root, str(index)),
                            transparency=True, ppa=False)
        self.rect.center = parent.center

    def load_configuration(self):
        config = self.get_configuration("pool")
        self.framerate = config["framerate"]
        self.frames_root = self.get_resource("pool", "water-path")
        self.groove_path = self.get_resource(join(config["water-path"],
                                                  config["groove-path"]))

    def load_groove(self):
        image = load(join(self.groove_path, str(self.index) + ".png"))
        surface = Surface(image.get_size())
        transparent_color = self.transparent_color
        surface.fill(transparent_color)
        surface.set_colorkey(transparent_color)
        surface.blit(image, (0, 0))
        self.groove = surface

    def draw(self):
        x, y = self.rect.topleft
        frame = self.get_current_frame()
        surface = self.display_surface
        groove = self.groove
        for dx, dy in self.parent.parent.parent.get_corners():
            surface.blit(frame, (x + dx, y + dy))
            surface.blit(groove, (x + dx, y + dy))
3.145.42.50
3.145.42.50
3.145.42.50
 
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.