ccoding 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccode/__init__.py +7 -0
- ccode/__main__.py +3 -0
- ccode/api.py +140 -0
- ccode/cli.py +12 -0
- ccode/config.py +145 -0
- ccode/env_schema.json +979 -0
- ccode/logo.py +177 -0
- ccode/ui.py +727 -0
- ccoding-0.1.0.dist-info/METADATA +144 -0
- ccoding-0.1.0.dist-info/RECORD +13 -0
- ccoding-0.1.0.dist-info/WHEEL +4 -0
- ccoding-0.1.0.dist-info/entry_points.txt +2 -0
- ccoding-0.1.0.dist-info/licenses/LICENSE +21 -0
ccode/logo.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import curses
|
|
4
|
+
import math
|
|
5
|
+
import random
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
LOGOS = [
|
|
9
|
+
# 1. Block (Original)
|
|
10
|
+
[
|
|
11
|
+
" ##### ##### ##### #### ##### ",
|
|
12
|
+
"## ## ## ## ## ## ## ## ## ##",
|
|
13
|
+
"## ## ## ## ## ## ## ",
|
|
14
|
+
"## ## ## ## ## ## ## ## ## ##",
|
|
15
|
+
" ##### ##### ##### #### ##### ",
|
|
16
|
+
" C C O D E L A U N C H E R ",
|
|
17
|
+
],
|
|
18
|
+
# 2. Slant
|
|
19
|
+
[
|
|
20
|
+
" ______ ______ ____ ____ ______ ",
|
|
21
|
+
" / ____// ____// __ \\/ __ \\/ ____/ ",
|
|
22
|
+
" / / / / / / / / / / / __/ ",
|
|
23
|
+
"/ /___ / /___ / /_/ / /_/ / /___ ",
|
|
24
|
+
"\\____/ \\____/ \\____/_____/_____/ ",
|
|
25
|
+
" LAUNCHER EDITION ",
|
|
26
|
+
],
|
|
27
|
+
# 3. Thin / Cyber
|
|
28
|
+
[
|
|
29
|
+
" ___ ___ ___ ___ ___ ",
|
|
30
|
+
" / __|/ __|/ _ \\| \\| __|",
|
|
31
|
+
"| (__| (__| (_) | |) | _| ",
|
|
32
|
+
" \\___|\\___|\\___/|___/|___|",
|
|
33
|
+
" C C O D E L A U N C H ",
|
|
34
|
+
],
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _put(stdscr: curses.window, y: int, x: int, text: str, attr: int = 0) -> None:
|
|
39
|
+
height, width = stdscr.getmaxyx()
|
|
40
|
+
if y < 0 or y >= height:
|
|
41
|
+
return
|
|
42
|
+
if x < 0:
|
|
43
|
+
text = text[-x:]
|
|
44
|
+
x = 0
|
|
45
|
+
if x >= width:
|
|
46
|
+
return
|
|
47
|
+
available = width - x
|
|
48
|
+
if available <= 0:
|
|
49
|
+
return
|
|
50
|
+
try:
|
|
51
|
+
stdscr.addstr(y, x, text[:available], attr)
|
|
52
|
+
except curses.error:
|
|
53
|
+
return
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _color_attr(
|
|
57
|
+
line_index: int,
|
|
58
|
+
col_index: int,
|
|
59
|
+
frame: int,
|
|
60
|
+
use_color: bool,
|
|
61
|
+
color_pairs: list[int],
|
|
62
|
+
) -> int:
|
|
63
|
+
if not use_color or not color_pairs:
|
|
64
|
+
return 0
|
|
65
|
+
wave = math.sin((frame / 6) + (line_index / 2) + (col_index / 6))
|
|
66
|
+
bias = (line_index + col_index + frame // 2) % len(color_pairs)
|
|
67
|
+
idx = int((wave + 1) * 0.5 * (len(color_pairs) - 1))
|
|
68
|
+
pair_id = color_pairs[(idx + bias) % len(color_pairs)]
|
|
69
|
+
return curses.color_pair(pair_id)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def render_style_wave(
|
|
73
|
+
stdscr: curses.window,
|
|
74
|
+
lines: list[str],
|
|
75
|
+
start_y: int,
|
|
76
|
+
frame: int,
|
|
77
|
+
use_color: bool,
|
|
78
|
+
color_pairs: list[int],
|
|
79
|
+
) -> None:
|
|
80
|
+
_, width = stdscr.getmaxyx()
|
|
81
|
+
max_len = max(len(line) for line in lines)
|
|
82
|
+
base_x = max(0, (width - max_len) // 2)
|
|
83
|
+
for row, line in enumerate(lines):
|
|
84
|
+
for col, ch in enumerate(line):
|
|
85
|
+
if ch == " ":
|
|
86
|
+
continue
|
|
87
|
+
wave_y = math.sin((frame / 6) + (col / 8)) * 0.6
|
|
88
|
+
jitter = math.sin((frame / 3) + (row * 1.3 + col / 5)) * 0.4
|
|
89
|
+
draw_y = int(round(start_y + row + wave_y + jitter))
|
|
90
|
+
dx = int(round(math.sin((frame / 8) + row) * 1.5))
|
|
91
|
+
draw_x = base_x + col + dx
|
|
92
|
+
shimmer = ((frame + col + row * 3) % 18 == 0)
|
|
93
|
+
attr = _color_attr(row, col, frame, use_color, color_pairs)
|
|
94
|
+
if shimmer:
|
|
95
|
+
attr |= curses.A_BOLD
|
|
96
|
+
_put(stdscr, draw_y, draw_x, ch, attr)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def render_style_pulse(
|
|
100
|
+
stdscr: curses.window,
|
|
101
|
+
lines: list[str],
|
|
102
|
+
start_y: int,
|
|
103
|
+
frame: int,
|
|
104
|
+
use_color: bool,
|
|
105
|
+
color_pairs: list[int],
|
|
106
|
+
) -> None:
|
|
107
|
+
_, width = stdscr.getmaxyx()
|
|
108
|
+
max_len = max(len(line) for line in lines)
|
|
109
|
+
base_x = max(0, (width - max_len) // 2)
|
|
110
|
+
for row, line in enumerate(lines):
|
|
111
|
+
for col, ch in enumerate(line):
|
|
112
|
+
if ch == " ":
|
|
113
|
+
continue
|
|
114
|
+
attr = 0
|
|
115
|
+
if use_color and color_pairs:
|
|
116
|
+
idx = (col + row + frame // 3) % len(color_pairs)
|
|
117
|
+
attr = curses.color_pair(color_pairs[idx])
|
|
118
|
+
if (frame + col + row) % 20 < 10:
|
|
119
|
+
attr |= curses.A_BOLD
|
|
120
|
+
_put(stdscr, start_y + row, base_x + col, ch, attr)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def render_style_glitch(
|
|
124
|
+
stdscr: curses.window,
|
|
125
|
+
lines: list[str],
|
|
126
|
+
start_y: int,
|
|
127
|
+
frame: int,
|
|
128
|
+
use_color: bool,
|
|
129
|
+
color_pairs: list[int],
|
|
130
|
+
) -> None:
|
|
131
|
+
_, width = stdscr.getmaxyx()
|
|
132
|
+
max_len = max(len(line) for line in lines)
|
|
133
|
+
base_x = max(0, (width - max_len) // 2)
|
|
134
|
+
for row, line in enumerate(lines):
|
|
135
|
+
for col, ch in enumerate(line):
|
|
136
|
+
if ch == " ":
|
|
137
|
+
continue
|
|
138
|
+
draw_y = start_y + row
|
|
139
|
+
draw_x = base_x + col
|
|
140
|
+
attr = 0
|
|
141
|
+
if use_color and color_pairs:
|
|
142
|
+
idx = (row + col) % len(color_pairs)
|
|
143
|
+
attr = curses.color_pair(color_pairs[idx])
|
|
144
|
+
if random.random() < 0.03:
|
|
145
|
+
glitch_type = random.randint(0, 2)
|
|
146
|
+
if glitch_type == 0:
|
|
147
|
+
draw_x += random.randint(-1, 1)
|
|
148
|
+
draw_y += random.randint(-1, 0)
|
|
149
|
+
elif glitch_type == 1:
|
|
150
|
+
ch = random.choice("!@#$%&?<>")
|
|
151
|
+
elif glitch_type == 2:
|
|
152
|
+
attr |= curses.A_REVERSE
|
|
153
|
+
_put(stdscr, draw_y, draw_x, ch, attr)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def render_style_rain(
|
|
157
|
+
stdscr: curses.window,
|
|
158
|
+
lines: list[str],
|
|
159
|
+
start_y: int,
|
|
160
|
+
frame: int,
|
|
161
|
+
use_color: bool,
|
|
162
|
+
color_pairs: list[int],
|
|
163
|
+
) -> None:
|
|
164
|
+
_, width = stdscr.getmaxyx()
|
|
165
|
+
max_len = max(len(line) for line in lines)
|
|
166
|
+
base_x = max(0, (width - max_len) // 2)
|
|
167
|
+
for row, line in enumerate(lines):
|
|
168
|
+
for col, ch in enumerate(line):
|
|
169
|
+
if ch == " ":
|
|
170
|
+
continue
|
|
171
|
+
attr = 0
|
|
172
|
+
if use_color and color_pairs:
|
|
173
|
+
idx = (row - (frame // 2)) % len(color_pairs)
|
|
174
|
+
attr = curses.color_pair(color_pairs[idx])
|
|
175
|
+
if (col * 7 + row * 13 + frame) % 17 == 0:
|
|
176
|
+
attr |= curses.A_BOLD
|
|
177
|
+
_put(stdscr, start_y + row, base_x + col, ch, attr)
|