from collections import deque
from math import ceil

from pygame import Surface
from pygame.draw import polygon
from pygame.locals import *

from _send.pgfw.Sprite import Sprite

class Arrow(Sprite):

    LEFT, RIGHT = (-1, 1)

    def __init__(self, parent, size, hue, saturation, overlap, count,
                 orientation):
        Sprite.__init__(self, parent)
        self.load_configuration()
        self.size = size
        self.hue = hue
        self.saturation = saturation
        self.overlap = overlap
        self.count = count
        self.orientation = orientation
        self.set_mask()
        self.set_hues()
        self.set_frames()

    def load_configuration(self):
        config = self.get_configuration("arrow")
        self.frame_count = config["frame-count"]

    def set_mask(self):
        surface = Surface(self.get_size())
        surface.set_colorkey((0, 0, 0))
        rect = surface.get_rect()
        width = self.size[0]
        x = 0
        for ii in xrange(self.count):
            if self.orientation == self.LEFT:
                points = (x, rect.centery), (x + width, 0),\
                         (x + width, rect.bottom)
            else:
                points = (x, 0), (x + width, rect.centery), (x, rect.bottom)
            polygon(surface, (255, 255, 255), points)
            x += width - self.overlap
        self.mask = surface

    def get_size(self):
        count = self.count
        return self.size[0] * count - self.overlap * (count - 1), self.size[1]

    def set_hues(self):
        start, end = self.hue
        step = float(end - start) / (self.frame_count - 1)
        hues = deque([start])
        while start < end:
            start += step
            hues.append(start)
        hues.append(end)
        self.hues = hues

    def set_frames(self):
        for _ in xrange(self.frame_count):
            self.append_frame()

    def append_frame(self):
        width, height = self.get_size()
        gradient = Surface((width, height))
        gradient.set_colorkey((0, 0, 0))
        hues = self.hues
        step = float(width) / self.count / len(hues)
        x = 0
        color = Color(0, 0, 0)
        while x < width:
            for hue in hues:
                color.hsla = hue, self.saturation, 50, 100
                gradient.fill(color, (int(x), 0, ceil(step), height))
                x += step
        hues.rotate(self.orientation)
        mask = self.mask.convert()
        gradient.blit(mask, (0, 0), None, BLEND_RGBA_MIN)
        self.add_frame(gradient)
from pygame.key import get_mods
from pygame.locals import *

from _send.pgfw.GameChild import GameChild

class Editor(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.fields = self.get_game().fields
        self.subscribe(self.respond_to_key, KEYDOWN)

    def respond_to_key(self, event):
        key = event.key
        fields = self.fields
        field = fields.get_current_field()
        mods = get_mods()
        step = self.get_step(mods)
        if key == K_h:
            self.adjust_color(field, (step, 0, 0), mods)
        elif key == K_s:
            self.adjust_color(field, (0, step, 0), mods)
        elif key == K_l:
            self.adjust_color(field, (0, 0, step), mods)
        elif key == K_BACKQUOTE:
            pass
        elif key == K_EQUALS:
            fields.write()
        elif key == K_b:
            pass
        elif key == K_c:
            pass
        elif key == K_t:
            pass
        elif key == K_RIGHTBRACKET:
            fields.load()
        elif key == K_LEFTBRACKET:
            fields.load(previous=True)
        elif key == K_w:
            fields.write()

    def get_step(self, mods):
        sign = -1 if self.alt_pressed(mods) else 1
        return 1 * sign if self.ctrl_pressed(mods) else 10 * sign

    def alt_pressed(self, mods):
        return mods & KMOD_ALT

    def ctrl_pressed(self, mods):
        return mods & KMOD_CTRL

    def adjust_color(self, field, channels, mods):
        if self.shift_pressed(mods):
            field.adjust_color(field.foreground_id, *channels)
        else:
            field.adjust_color(field.background_id, *channels)

    def shift_pressed(self, mods):
        return mods & KMOD_SHIFT
from pygame import Surface, Color
from pygame.font import Font
from pygame.locals import *

from _send.pgfw.Animation import Animation
from _send.pgfw.Sprite import Sprite
from _send.field.ball.Ball import Ball
from _send.field.Cup import Cup

class Field(Animation):

    background_id, foreground_id = 0, 1

    def __init__(self, parent, name, ball_scale, cup_scale, speed,
                 tartan_scale, background_color, foreground_color):
        Animation.__init__(self, parent)
        self.name = name
        self.ball_scale = ball_scale
        self.cup_scale = cup_scale
        self.speed = speed
        self.tartan_scale = tartan_scale
        self.colors = background_color, foreground_color
        self.title = Title(self)
        self.register(self.deactivate_title)

    def load(self, suppress_title=False):
        self.halt()
        if not suppress_title:
            self.title.unhide()
            self.play(self.deactivate_title, delay=5000)
        self.display_surface = self.get_display_surface()
        self.set_background()
        self.set_ball()
        self.set_cup()

    def deactivate_title(self):
        self.title.hide()

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

    def paint_background(self):
        self.background.fill(self.get_background_color())

    def get_background_color(self):
        return self.colors[self.background_id]

    def set_ball(self):
        self.ball = Ball(self)

    def set_cup(self):
        self.cup = Cup(self)

    def __str__(self):
        br, bg, bb, ba = self.get_background_color()
        fr, fg, fb, fa = self.get_foreground_color()
        return "%s | %.3f %.3f %.3f %.3f | %i, %i, %i | %i, %i, %i" % \
               (self.name, self.ball_scale, self.cup_scale, self.speed,
                self.tartan_scale, br, bg, bb, fr, fg, fb)

    def get_foreground_color(self):
        return self.colors[self.foreground_id]

    def adjust_color(self, index, dh, ds, dl):
        colors = self.colors
        hue, saturation, lightness, alpha = colors[index].hsla
        hue, saturation, lightness = hue + dh, saturation + ds, lightness + dl
        constrain = self.constrain_channel
        hue = constrain(hue, 360)
        saturation = constrain(saturation, 100)
        lightness = constrain(lightness, 100)
        colors[index].hsla = hue, saturation, lightness, alpha
        self.paint_background()
        self.ball.set_color()
        self.cup.set_color()

    def constrain_channel(self, channel, limit):
        if channel < 0:
            channel = 0
        elif channel > limit:
            channel = limit
        return channel

    def unload(self):
        del self.display_surface
        del self.ball
        del self.cup
        del self.background

    def update(self):
        Animation.update(self)
        self.clear()
        self.title.update()
        self.cup.update()
        self.ball.update()

    def clear(self, rect=None):
        if rect is None:
            rect = self.background.get_rect()
        self.display_surface.blit(self.background, rect)


class Title(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        color = Color(0, 0, 0)
        font = Font(self.get_resource("display", "font-path"), 14)
        font.set_bold(True)
        font.set_italic(True)
        name = parent.name.upper()
        shadow = font.render(name, True, parent.get_background_color())
        mask = font.render(name, True, parent.get_foreground_color())
        base = Surface((shadow.get_width() + 5, shadow.get_height() + 1),
                       SRCALPHA)
        for ii, lightness in enumerate(xrange(0, 100, 5)):
            color.hsla = 60, 100, lightness, 100
            frame = base.copy()
            for x in xrange(0, frame.get_width(), 2):
                frame.set_at((x, frame.get_height() - 1),
                             self.get_dot_color(x, ii))
            for y in xrange(0, frame.get_height(), 2):
                frame.set_at((frame.get_width() - 1, y),
                             self.get_dot_color(y, ii))
            frame.blit(shadow, (0, 0))
            frame.blit(mask, (2, 0))
            text = font.render(name, True, color)
            frame.blit(text, (4, 0))
            self.add_frame(frame)
        self.location.topleft = parent.parent.sidelines[0].bottomleft

    def get_dot_color(self, a, b):
        return Color(*((0, 0, 0), (255, 255, 255))[((a / 2) % 2 + (b % 2)) % 2])
18.97.9.170
18.97.9.170
18.97.9.170
 
March 3, 2021

Video 📺

Computers are a gun. They can see the target; they can pull the trigger. Computers were made by the military to blow people's brains out if they stepped out of line. Google Coral is the same technology that pollutes the oceans, and so is the computer I'm using, and so are the platforms I'm using to post this.

Game 🎲

Games are a context in which all play is purposeful. Games expose the fundamentally nihilistic nature of the universe and futility of pursuing any path other than the inevitability of death and the torture of an evil that knows and exploits absolute freedom. Games are not educational; they are education.

Propaganda 🆒

Education is propaganda — ego driven by-product conveying nothing that would enable us to expose that vanities made for gain subject us further to an illusion created by those in control: the illusion that quantity can represent substance and that data or observation can replace meaning. And why say it, or how, without contradicting yourself, that everything, once registered, no longer exists, and in fact never did, exists only in relation to other non-existent things, and when you look, it's not there, not only because it's long vanished, but because where would it be?


fig. 2: Gamer goo is a lubricant — not for your skin, but for facilitating your ability to own the competition (image from Gamer goo review)

As a result of video games, the great Trojan horse 🎠 of imperialist consumerist representationalism, people are divided in halves to encourage them to act according to market ordained impulses, to feign assurance, penetrating themselves deeper into a tyranny from which every action signals allegiance, confusing the world with definitions and borders, constantly struggling to balance or brace themselves against forces that threaten the crumbling stability of their ego.

F

or example, a cup 🥃 is designed and built to hold something, maintain order and prevent chaos. It keeps water from spilling back to where it belongs, back where it wants to go and gravity wants it to go. The cup is a trap, and it is used to assert dominance over nature, to fill with thoughts about existence, time and self, thoughts regarding dissimilarity between equal parts and patterns that manifest in variation. These ruminations disguised as revelations boil away to reveal isolated and self-aggrandizing thoughts about an analogy fabricated to herald the profundity of one's campaign's propaganda. You have no authentic impulse except to feed a delusion of ultimate and final supremacy. That is why you play games. That is your nature. That is why you eventually smash the cup to bits 💥 or otherwise watch it disintegrate forever because it, by being useful, threatens your facade of ownership and control.


fig. 3: worth1000

The cup is you; it reflects you; it is a lens through which you see yourself; it reassures you, confirming your presence; it says something, being something you can observe. When you move, it moves, and it opens after being closed. You can use it as a vessel for penetration fantasies, keeping you warm and fertile, a fine host for the plague of consciousness, you reptile, you sun scorched transgressor that not only bites the hand that feeds, but buries it deep within a sterile chamber where nothing remains for it as a means of escape except the corpses of others that infringed upon your feeding frenzy.