Compare commits
2 Commits
fe97b2ca13
...
bbdead0b2e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbdead0b2e | ||
|
|
4eaf0dbd98 |
Binary file not shown.
|
Before Width: | Height: | Size: 244 B |
Binary file not shown.
|
Before Width: | Height: | Size: 260 B |
Binary file not shown.
|
Before Width: | Height: | Size: 240 B |
Binary file not shown.
|
Before Width: | Height: | Size: 267 B |
@@ -1,10 +1,6 @@
|
||||
import arcade
|
||||
|
||||
sprites = {
|
||||
"louisu": arcade.load_texture("res/sprite/louisu.png"),
|
||||
"louisd": arcade.load_texture("res/sprite/louisd.png"),
|
||||
"louisl": arcade.load_texture("res/sprite/louisl.png"),
|
||||
"louisb": arcade.load_texture("res/sprite/louisb.png"),
|
||||
"cursor": arcade.load_texture("res/sprite/handcursor.png"),
|
||||
"font": arcade.load_spritesheet("res/sprite/font.png"),
|
||||
"panel": arcade.load_spritesheet("res/sprite/panel.png"),
|
||||
|
||||
38
src/controls.py
Normal file
38
src/controls.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import arcade
|
||||
|
||||
class Control:
|
||||
def __init__(self, key, label):
|
||||
self.key = key
|
||||
self.label = label
|
||||
self.pressed = False
|
||||
self.held = False
|
||||
|
||||
controls = [
|
||||
Control(arcade.key.W, "Fel"),
|
||||
Control(arcade.key.S, "Le"),
|
||||
Control(arcade.key.A, "Bal"),
|
||||
Control(arcade.key.D, "Jobb"),
|
||||
]
|
||||
|
||||
def key_press(key):
|
||||
for c in controls:
|
||||
if c.key == key:
|
||||
c.pressed = True
|
||||
|
||||
def key_release(key):
|
||||
for c in controls:
|
||||
if c.key == key:
|
||||
c.pressed = False
|
||||
c.held = False
|
||||
|
||||
def update():
|
||||
for c in controls:
|
||||
if c.pressed:
|
||||
c.pressed = False
|
||||
c.held = True
|
||||
|
||||
def is_control_pressed(cid):
|
||||
return controls[cid].pressed
|
||||
|
||||
def is_control_held(cid):
|
||||
return controls[cid].held
|
||||
@@ -1,15 +0,0 @@
|
||||
import arcade
|
||||
import assets
|
||||
import text
|
||||
|
||||
text = text.TextRenderer(0, 100, 200)
|
||||
|
||||
def switch():
|
||||
text.reset("●A bölcs, gyors, fürge róka zöld ágon ül, miközben egy tyúk csípős paprikát főz, és egy whiskyvel teli dobozt cipelő dzsesszzenész kvázi jókedvűen fütyörészik.")
|
||||
text.type_all()
|
||||
|
||||
def update(dt):
|
||||
pass
|
||||
|
||||
def draw(game):
|
||||
text.render()
|
||||
@@ -1,17 +1,23 @@
|
||||
import arcade
|
||||
import assets
|
||||
import controls
|
||||
import text
|
||||
import renderers
|
||||
|
||||
text = text.TextRenderer(6, 186, 210)
|
||||
panel = renderers.NineSlicesPanel(0,100,230,100);
|
||||
panel = renderers.NineSlicesPanel(0,100,230,100)
|
||||
|
||||
def switch():
|
||||
text.reset("●A bölcs, gyors, fürge róka zöld ágon ül, miközben egy tyúk csípős paprikát főz, és egy whiskyvel teli dobozt cipelő dzsesszzenész kvázi jókedvűen fütyörészik.")
|
||||
text.type_all()
|
||||
pass
|
||||
|
||||
def update(dt):
|
||||
pass
|
||||
controltext = ""
|
||||
|
||||
for c in controls.controls:
|
||||
controltext += f"{c.label}: {c.pressed}-{c.held}\n"
|
||||
|
||||
text.reset(controltext)
|
||||
text.type_all()
|
||||
|
||||
def draw(game):
|
||||
arcade.draw_rect_filled(
|
||||
|
||||
@@ -2,6 +2,7 @@ import arcade
|
||||
import assets
|
||||
import gamestate
|
||||
import renderers
|
||||
import controls
|
||||
import text
|
||||
|
||||
SCREEN_WIDTH = 256
|
||||
@@ -33,6 +34,13 @@ class Game(arcade.Window):
|
||||
|
||||
def on_update(self, dt):
|
||||
gamestate.update(dt)
|
||||
controls.update()
|
||||
|
||||
def on_key_press(self, symbol, modifiers):
|
||||
controls.key_press(symbol)
|
||||
|
||||
def on_key_release(self, symbol, modifiers):
|
||||
controls.key_release(symbol)
|
||||
|
||||
def on_draw(self):
|
||||
self.framebuffer.use()
|
||||
|
||||
@@ -26,6 +26,8 @@ class TextRenderer:
|
||||
self.text = text
|
||||
self.textptr = 0
|
||||
self.sprites = []
|
||||
self.x = self.base_x
|
||||
self.y = self.base_y
|
||||
|
||||
def amend(self, text):
|
||||
self.text = self.text + text
|
||||
|
||||
Reference in New Issue
Block a user