GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactor: Remove code repetition in KeyCode enum by AnarDevStudio · Pull Request #84 · pyunity/pyunity

Refactor: Remove code repetition in KeyCode enum #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AnarDevStudio wants to merge 1 commit into pyunity:develop
base: develop
Loading
Loading
from AnarDevStudio:refactor-keycode-enum

Uh oh!

There was an error while loading. Please reload this page.

Open

Refactor: Remove code repetition in KeyCode enum #84

Changes from all commits
Commits
Show all changes
1 commit
Select commit
4fc5567
Refactor: Remove code repetition in KeyCode enum
AnarDevStudio Jan 7, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Refactor: Remove code repetition in KeyCode enum
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@AnarDevStudio
AnarDevStudio committed Jan 7, 2026
commit 4fc55674062b354e20f0ae127063c21706c263a6

There are no files selected for viewing

87 changes: 24 additions & 63 deletions 87 pyunity/input.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,76 +10,37 @@
from enum import IntEnum, auto
import os

from enum import IntEnum, auto

class KeyState(IntEnum):
UP = auto()
DOWN = auto()
PRESS = auto()
NONE = auto()

class KeyCode(IntEnum):
A = auto()
B = auto()
C = auto()
D = auto()
E = auto()
F = auto()
G = auto()
H = auto()
I = auto()
J = auto()
K = auto()
L = auto()
M = auto()
N = auto()
O = auto()
P = auto()
Q = auto()
R = auto()
S = auto()
T = auto()
U = auto()
V = auto()
W = auto()
X = auto()
Y = auto()
Z = auto()
Space = auto()
Alpha0 = auto()
Alpha1 = auto()
Alpha2 = auto()
Alpha3 = auto()
Alpha4 = auto()
Alpha5 = auto()
Alpha6 = auto()
Alpha7 = auto()
Alpha8 = auto()
Alpha9 = auto()
F1 = auto()
F2 = auto()
F3 = auto()
F4 = auto()
F5 = auto()
F6 = auto()
F7 = auto()
F8 = auto()
F9 = auto()
F10 = auto()
F11 = auto()
F12 = auto()
Keypad0 = auto()
Keypad1 = auto()
Keypad2 = auto()
Keypad3 = auto()
Keypad4 = auto()
Keypad5 = auto()
Keypad6 = auto()
Keypad7 = auto()
Keypad8 = auto()
Keypad9 = auto()
Up = auto()
Down = auto()
Left = auto()
Right = auto()
pass

_keys = {}
for letter in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
_keys[letter] = auto()

_keys['Space'] = auto()

for i in range(10):
_keys[f'Alpha{i}'] = auto()

for i in range(1, 13):
_keys[f'F{i}'] = auto()

for i in range(10):
_keys[f'Keypad{i}'] = auto()

for direction in ['Up', 'Down', 'Left', 'Right']:
_keys[direction] = auto()

# KeyCode enum'unu oluştur
KeyCode = IntEnum('KeyCode', _keys)

class MouseCode(IntEnum):
Left = auto()
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.