Ejemplo n.º 1
0
        vec3 bA = texelFetch(iChannel0, ivec2(fragCoord), 0).rgb;
        vec3 bB = texelFetch(iChannel1, ivec2(fragCoord), 0).rgb;

        vec3 col_rgb = bB;

        col_rgb = col_rgb*exp2(3.5);

        fragColor = vec4(pow(col_rgb, vec3(1./2.2)), 1.);
    } 

""", 512, 256, 0, 420, 0, 'left', 'top')

st1.set_channel(0, ba1)
st1.set_channel(1, bb1)

keyboard_layout = Sprite('images/keyboard.png', x=256, y=82, scale=0.5)
label0 = Label('amp: %.2f' % get_master_volume(),
               anchor_x='right',
               x=app.width - 10,
               y=174)
label1 = Label('use ↑ ↓ to control volume', x=10, y=194)
label2 = Label('tap SPACE to change shader', x=10, y=174)

state = State(
    up=False,
    down=False,
    shader=0,
)

keys = app.window.keys
Ejemplo n.º 2
0
window = app.window

WIDTH = app.width
HEIGHT = app.height

background = '#3e32a2'
foreground = '#7c71da'

app.set_window_color(foreground)

a0 = np.ones((32, 32)) * 255
a1 = np.ones((128, 16)) * 255
a2 = np.ones((HEIGHT * 9 // 10, WIDTH * 9 // 10,
              3)) * jupylet.color.color2rgb(background)[:3]

ball = Sprite(a0, y=HEIGHT / 2, x=WIDTH / 2, autocrop=True)

padl = Sprite(a1, y=HEIGHT / 2, x=48)
padr = Sprite(a1, y=HEIGHT / 2, x=WIDTH - 48)

field = Sprite(a2, y=HEIGHT / 2, x=WIDTH / 2)

sound = pyglet.media.load('sounds/pong-blip.wav', streaming=False)

pyglet.font.add_file('fonts/PetMe64.ttf')

scorel = Label('0',
               font_name='Pet Me 64',
               font_size=42,
               color=foreground,
               x=64,
Ejemplo n.º 3
0
from jupylet.sprite import Sprite

from jupylet.audio.sample import Sample

import moderngl_window.timers.clock as _clock

app = App()

background = '#3e32a2'
foreground = '#7c71da'

a0 = np.ones((32, 32)) * 255
a1 = np.ones((128, 16)) * 255
a2 = np.ones((app.height * 9 // 10, app.width * 9 // 10, 3)) * 255

ball = Sprite(a0, y=app.height / 2, x=app.width / 2)

padl = Sprite(a1, y=app.height / 2, x=48)
padr = Sprite(a1, y=app.height / 2, x=app.width - 48)

field = Sprite(a2, y=app.height / 2, x=app.width / 2, color=background)

pong_sound = Sample('sounds/pong-blip.wav', amp=0.2).load()

scorel = Label('0',
               font_size=42,
               color=foreground,
               x=64,
               y=app.height / 2,
               anchor_y='center',
               anchor_x='left',
Ejemplo n.º 4
0
import logging
import math
import sys
import os

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from jupylet.sprite import Sprite
from jupylet.label import Label
from jupylet.app import App

logger = logging.getLogger()

app = App()

stars = Sprite('images/stars.png', scale=2.5)
alien = Sprite('images/alien.png', scale=0.5)
ship = Sprite('images/ship1.png', x=app.width / 2, y=app.height / 2, scale=0.5)
moon = Sprite('images/moon.png',
              x=app.width - 70,
              y=app.height - 70,
              scale=0.5)

circle = Sprite('images/yellow-circle.png', width=184)
circle.opacity = 0.

label = Label('hello, world', color='cyan', font_size=32, x=10, y=10)


@app.event
def mouse_position_event(x, y, dx, dy):
Ejemplo n.º 5
0
import pyglet.window.key as key


if __name__ == '__main__':
    mode = 'window'
else:
    mode = 'hidden'

app = App(mode=mode)

window = app.window

WIDTH = app.width
HEIGHT = app.height

stars = Sprite('stars.png', scale=2.5)
alien = Sprite('alien.png', scale=0.5)
ship = Sprite('ship1.png', x=WIDTH/2, y=HEIGHT/2, scale=0.5)
moon = Sprite('moon.png', x=WIDTH-70, y=HEIGHT-70, scale=0.5)

circle = Sprite('yellow-circle.png')
circle.opacity = 0
circle.width = 184

label = Label('Hello World!', color='cyan', font_size=16, x=10, y=10)


@app.event
def on_draw():
    
    window.clear()
Ejemplo n.º 6
0
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

import jupylet.color

from jupylet.app import App
from jupylet.state import State
from jupylet.label import Label
from jupylet.sprite import Sprite

from jupylet.audio.bundle import *


app = App(width=512, height=420)#, log_level=logging.INFO)

oscilloscope = Sprite(np.zeros((256, 512, 4), 'uint8'), x=256, y=292)

keyboard_layout = Sprite('images/keyboard.png', x=256, y=82, scale=0.5)


state = State(
    
    amp = 1.,
    ms = 50.,
    
    up = False,
    down = False,
    left = False,
    right = False,
)