-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyga.py
More file actions
866 lines (814 loc) · 22.7 KB
/
Copy pathpyga.py
File metadata and controls
866 lines (814 loc) · 22.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
"""
pyga.py - Pygame图形界面工具库
功能:
1. 提供简化的pygame窗口管理功能
2. 封装常用图形绘制操作(矩形、圆形、线条等)
3. 实现按钮、文本等UI组件
4. 支持3D图形绘制功能
5. 提供音频播放控制接口
作者: [HCID274]
版本: 1.2
"""
# 导入所需模块
# 版本信息
#v1.2
import pygame # 主图形库
import math # 数学计算
from pygame import mixer # 音频处理
# 全局变量
buttoncount=1 # 按钮计数器
win='' # 窗口对象
sx=0 # 屏幕宽度
sy=0 # 屏幕高度
X=0 # 3D视角X坐标
Y=0 # 3D视角Y坐标
Z=0 # 3D视角Z坐标
fov=0 # 视野角度
viewdist=10 # 可视距离
try:
viewdist=viewdist*10 # 尝试调整可视距离
except:
viewdist=viewdist # 失败则保持原值
viewdistq=0 # 可视距离质量设置
def getkey():
"""
获取键盘按键输入
返回:按下的键名或字符
"""
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
# 处理特殊功能键
if event.key == pygame.K_RSHIFT:
return 'rshift'
elif event.key == pygame.K_LSHIFT:
return 'lshift'
elif event.key == pygame.K_LALT:
return 'lalt'
elif event.key == pygame.K_RALT:
return 'ralt'
elif event.key == pygame.K_LCTRL:
return 'lctrl'
elif event.key == pygame.K_RCTRL:
return 'rctrl'
elif event.key == pygame.K_KP_ENTER:
return 'enter'
elif event.key == pygame.K_RETURN:
return 'enter'
elif event.key == pygame.K_BACKSPACE:
return 'backspace'
elif event.key == pygame.K_TAB:
return 'tab'
else:
# 返回普通字符
return str(event.unicode)
else:
return None
def get_type2(val):
"""
递归获取输入类型
"""
value=get_type(val)
if('<Thread' not in value):
return get_type2(val)
else:
return ''
def get_type(dur):
"""
获取指定时间内的键盘输入
参数:dur - 持续时间
返回:按下的键名列表,以逗号分隔
"""
toadd=''
tyt=''
h=0
while(h<dur):
toadd=str(getkey())
if(toadd!='None'):
tyt+=(str(toadd)+',')
else:
toadd=str(getkey())
if(toadd!='None'):
tyt+=(str(toadd)+',')
h+=1
continue
toadd=''
return tyt
def d3_init(StartPos, Quality, ViewDistance, Fov):
"""
初始化3D渲染设置
参数:
StartPos - 起始位置 (x,y,z)
Quality - 渲染质量
ViewDistance - 可视距离
Fov - 视野角度
"""
global sx, sy, fov, X, Y, Z, viewdistq, viewdist, quality
# 设置屏幕中心点
sx = int(sx / 2)
sy = int(sy / 2)
# 设置渲染参数
quality = Quality
viewdistq = ViewDistance
fov = Fov
try:
# 设置起始位置
X = int(StartPos[0])
Y = int(StartPos[1])
Z = int(StartPos[2])
except:
# 如果起始位置参数错误则抛出异常
error = "Start Pos Needs 3 Numbers"
raise error
def display_init(size, name="Pyga Window", resize=False, frame=True):
"""
初始化显示窗口
参数:
size - 窗口尺寸 (width, height)
name - 窗口标题
resize - 是否可调整大小
frame - 是否显示窗口边框
"""
global win, sx, sy
# 设置窗口尺寸
sx = size[0]
sy = size[1]
# 设置窗口样式
p = False if frame else pygame.NOFRAME
# 初始化Pygame
pygame.init()
# 创建窗口
if resize:
win = pygame.display.set_mode(size, pygame.RESIZABLE, p)
else:
win = pygame.display.set_mode(size, p)
# 设置窗口标题
if name:
pygame.display.set_caption(name)
def state(size,flag):
global win
pygame.init()
#if(__name__=="__main__"):
win=pygame.display.set_mode((size),flags=flag)
def mixer_init():
"""
初始化音频系统
"""
pygame.mixer.init()
def init_main(size, name, resize):
"""
初始化主系统(显示+音频)
参数:
size - 窗口尺寸
name - 窗口标题
resize - 是否可调整大小
"""
display_init(size, name, resize)
mixer_init()
def init_all(size, name, resize, StartPos, Quality, ViewDistance, Fov):
"""
初始化所有系统(显示+3D+音频)
参数:
size - 窗口尺寸
name - 窗口标题
resize - 是否可调整大小
StartPos - 3D起始位置
Quality - 渲染质量
ViewDistance - 可视距离
Fov - 视野角度
"""
display_init(size, name, resize)
d3_init(StartPos, Quality, ViewDistance, Fov)
mixer_init()
def rect(position, size, color, trans=None):
"""
绘制矩形
参数:
position - 矩形位置 (x,y)
size - 矩形尺寸 (width,height)
color - 颜色 (r,g,b)
trans - 透明度 (0-255)
"""
s = pygame.Surface(size)
if trans: # 如果设置了透明度
s.set_alpha(255 - trans)
s.fill(color)
win.blit(s, position)
def fill(color):
"""
填充背景颜色
参数:
color - 颜色 (r,g,b)
"""
win.fill(color)
def hide4():
"""
最小化窗口
"""
pygame.display.iconify()
def quit():
"""
安全退出程序,释放所有资源
"""
try:
try:
pygame.quit() # 退出Pygame
except:
pass
try:
pygame.mixer.quit() # 退出音频系统
except:
pass
try:
pygame.display.update() # 更新显示
except:
pass
try:
# 处理退出事件
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
except:
pass
except:
pass
def pygam(pyg):
"""
动态执行Pygame命令
参数:
pyg - 要执行的Pygame命令字符串
"""
exec("pygame." + pyg)
def update():
"""
更新显示并处理事件
"""
global buttoncount
global clicked
# 更新显示
pygame.display.update()
# 重置按钮状态
buttoncount = -1
clicked = None
# 处理事件
for event in pygame.event.get():
if event.type == pygame.QUIT: # 处理退出事件
pygame.quit()
try:
pygame.mixer.quit() # 退出音频系统
except:
blank = ""
exit()
def nocloseupdate():
"""
更新显示但不退出程序
返回:如果检测到关闭事件则返回"close",否则返回None
"""
global buttoncount
global clicked
# 更新显示
pygame.display.update()
# 重置按钮状态
buttoncount = -1
clicked = None
# 处理事件
for event in pygame.event.get():
if event.type == pygame.QUIT: # 检测关闭事件
return "close"
return None
def text(tex, pos, color, size):
"""
绘制文本
参数:
tex - 要显示的文本
pos - 文本位置 (x,y)
color - 文本颜色 (r,g,b)
size - 字体大小
"""
try:
# 尝试加载黑体字体
font = pygame.font.Font('simhei.ttf', size)
except:
try:
# 尝试从Windows字体目录加载黑体
font = pygame.font.Font(r'C:\Windows\Fonts\simhei.ttf', size)
except:
try:
# 使用系统默认字体
font = pygame.font.Font(None, size)
except:
# 使用系统自带黑体
font = pygame.font.SysFont('simhei', size)
# 渲染文本
img = font.render(str(tex), True, color)
win.blit(img, pos)
clicked=0
pa=False
def mouse():
try:
mousee = pygame.mouse.get_pos()
click = pygame.mouse.get_pressed()
except:
mousee=(0,0)
click=False
return mousee,click
def button(tex, pos, size, color):
"""
绘制按钮并处理点击事件
参数:
tex - 按钮文本
pos - 按钮位置 (x,y)
size - 按钮尺寸 (width,height)
color - 按钮颜色 (r,g,b)
"""
global clicked, pa, buttoncount
# 增加按钮计数器
buttoncount += 1
# 获取鼠标状态
mouse = pygame.mouse.get_pos()
click = pygame.mouse.get_pressed()
# 检查鼠标是否在按钮区域内
if (pos[0] + size[0] > mouse[0] > pos[0] and
pos[1] + size[1] > mouse[1] > pos[1]):
# 绘制选中状态的按钮
rect((pos[0] - 2, pos[1] - 2),
(size[0] + 4, size[1] + 4),
(100, 100, 255), 0)
rect(pos, size, color, 0)
# 处理点击事件
if click[0] == 1 and not pa: # 检测鼠标按下且之前未按下
clicked = buttoncount
pa = True # 设置按钮为按下状态
elif click[0] == 0: # 检测鼠标释放
pa = False # 重置按钮状态
else:
# 绘制未选中状态的按钮
rect((pos[0] - 2, pos[1] - 2),
(size[0] + 4, size[1] + 4),
(150, 150, 150), 0)
rect(pos, size, color, 0)
# 绘制按钮文字
text(tex, (pos[0] + 2, pos[1] + 2), (0, 0, 0), 20)
def line(start, end, color, width):
"""
绘制直线
参数:
start - 起点坐标 (x,y)
end - 终点坐标 (x,y)
color - 颜色 (r,g,b)
width - 线宽
"""
pygame.draw.line(win, color, start, end, width)
def circle(pos, radius, color):
"""
绘制圆形
参数:
pos - 圆心位置 (x,y)
radius - 半径
color - 颜色 (r,g,b)
"""
pygame.draw.circle(win, color, pos, radius)
def orect(x, y, sx, sy, color, trans):
"""
绘制带透明度的矩形
参数:
x, y - 矩形左上角坐标
sx, sy - 矩形尺寸 (width, height)
color - 颜色 (r,g,b)
trans - 透明度 (0-255)
"""
rect((x, y), (sx, sy), color, trans)
def outline(x, y, sx, sy, thick, color):
"""
绘制矩形边框
参数:
x, y - 矩形左上角坐标
sx, sy - 矩形尺寸 (width, height)
thick - 边框厚度
color - 颜色 (r,g,b)
"""
# 绘制左边框
orect(x, y, thick, sy, color, 0)
# 绘制右边框
orect((x + sx) - thick, y, thick, sy, color, 0)
# 绘制下边框
orect(x, (y + sy) - thick, sx, thick, color, 0)
# 绘制上边框
orect(x, y, sx, thick, color, 0)
sd=''
def mouse():
"""
获取鼠标状态
返回:包含鼠标位置和点击状态的元组 (x, y, is_clicked)
"""
try:
# 获取鼠标位置和点击状态
return (pygame.mouse.get_pos()[0], # 鼠标x坐标
pygame.mouse.get_pos()[1], # 鼠标y坐标
pygame.mouse.get_pressed()[0]) # 左键是否按下
except:
# 如果获取失败,返回默认值
return (0, 0, False)
def getimg(place):
"""
加载图像文件,支持多种格式和路径
参数:
place - 图像文件路径或名称
返回:加载的图像对象,如果失败则返回None
"""
try:
# 尝试加载PNG格式
return pygame.image.load(sd + '\\' + place + '.png')
except:
try:
return pygame.image.load(place + '.png')
except:
try:
# 尝试加载JPG格式
try:
return pygame.image.load(sd + '\\' + place + '.jpg')
except:
try:
return pygame.image.load(place + '.jpg')
except:
try:
# 尝试加载WEBP格式
return pygame.image.load(sd + '\\' + place + '.webp')
except:
try:
return pygame.image.load(place + '.webp')
except:
try:
# 尝试直接加载文件
return pygame.image.load(sd + '\\' + place)
except:
try:
return pygame.image.load(place)
except:
return None
except:
return None
def getani(dirrr):
"""
加载动画序列图像
参数:
dirrr - 动画文件所在目录
返回:包含11帧图像的元组 (a,b,c,d,e,f,g,h,i,j,k)
"""
# 初始化11个图像变量
a = ''
b = ''
c = ''
d = ''
e = ''
f = ''
g = ''
h = ''
i = ''
j = ''
k = ''
dirr = dirrr
try:
# 加载第一帧
a = getimg(dirr + 'a')
except:
# 如果失败,尝试添加路径分隔符
dirr = dirr + '\\'
a = getimg(dirr + 'a')
try:
# 加载剩余帧
b = getimg(dirr + 'b')
c = getimg(dirr + 'c')
d = getimg(dirr + 'd')
e = getimg(dirr + 'e')
f = getimg(dirr + 'f')
g = getimg(dirr + 'g')
h = getimg(dirr + 'h')
i = getimg(dirr + 'i')
j = getimg(dirr + 'j')
k = getimg(dirr + 'k')
except:
blank = ''
return a, b, c, d, e, f, g, h, i, j, k
def image(img, pos, size, rotate, trans, flip):
"""
显示图像并应用变换
参数:
img - 图像对象
pos - 显示位置 (x,y)
size - 图像尺寸 (width,height)
rotate - 旋转角度
trans - 透明度 (0-255)
flip - 翻转设置 (x_flip,y_flip)
"""
# 应用翻转
imge = pygame.transform.flip(img, flip[0], flip[1])
# 调整尺寸
imgo = pygame.transform.scale(imge, size)
# 应用旋转
imgf = pygame.transform.rotate(imgo, rotate - 90)
# 设置透明度
s = imgf
s.set_alpha(255 - trans)
# 显示图像
win.blit(s, pos)
def getdisp_img(imgdir, pos, size, rotate, trans, flip):
"""
加载并显示图像
参数:
imgdir - 图像文件路径
pos - 显示位置 (x,y)
size - 图像尺寸 (width,height)
rotate - 旋转角度
trans - 透明度 (0-255)
flip - 翻转设置 (x_flip,y_flip)
"""
# 加载图像
i = getimg(imgdir)
# 显示图像
image(i, pos, size, rotate, trans, flip)
def mixer_load_sound(s):
"""
加载音效文件
参数:s - 音效文件路径
返回:Sound对象
"""
return pygame.mixer.Sound(s)
def mixer_sound(obj):
"""
播放音效
参数:obj - Sound对象
"""
pygame.mixer.Sound.play(obj)
def mixer_load(directory):
"""
加载背景音乐
参数:directory - 音乐文件路径
"""
mixer.music.load(directory)
def mixer_unload():
"""
卸载当前背景音乐
"""
pygame.mixer.music.unload()
def mixer_play():
"""
播放背景音乐
"""
pygame.mixer.music.play()
def mixer_play_obj(sound):
"""
播放指定背景音乐
参数:sound - 音乐对象
"""
pygame.mixer.music.play(sound)
def mixer_replay():
"""
重新播放当前背景音乐
"""
pygame.mixer.music.rewind()
def mixer_pause():
"""
暂停背景音乐
"""
pygame.mixer.music.pause()
def mixer_unpause():
"""
继续播放背景音乐
"""
pygame.mixer.music.unpause()
def mixer_volume(vol):
"""
设置背景音乐音量
参数:vol - 音量值 (0.0-1.0)
"""
pygame.mixer.music.set_volume(vol)
def mixer_stop():
"""
停止背景音乐
"""
pygame.mixer.music.stop()
def mixer_busy():
"""
检查背景音乐是否正在播放
返回:True/False
"""
if(pygame.mixer.music.get_busy()==1):
return True
else:
return False
def mixer_start(seconds):
"""
从指定时间开始播放背景音乐
参数:seconds - 开始时间(秒)
"""
pygame.mixer.music.set_pos(seconds)
def mixer_get_time():
"""
获取当前播放时间
返回:当前播放时间(毫秒)
"""
return pygame.mixer.music.get_pos()
dx=-999
dy=-999
camx=0
camy=0
camz=0
color=(0,0,0)
def goto(x,y,z):
global dx
global dy
try:
if(dx==999 or dy==999):
dx=int(fov*((x+camx)/(z+camz)))
dy=int(fov*((y+camy)/(z+camz)))
if(dx==-999 or dy==-999):
#if(math.sqrt(((dx+sx)-int(fov*((x+camx)/(z+camz)))+sx)^2+((dy+sy)-int(fov*((y+camy)/(z+camz)))+sy)^2)>400):
dx=int(fov*((x+camx)/(z+camz)))
dy=int(fov*((y+camy)/(z+camz)))
else:
if(dx!=-999 and dy!=-999):
if(dx<900 and dy<900):
if(15-int(((camz)/50)*10)>1):
if(math.sqrt(((dx+sx)-int(fov*((x+camx)/(z+camz)))+sx)^2+((dy+sy)-int(fov*((y+camy)/(z+camz)))+sy)^2)<30):
line((dx+sx,dy+sy),(int(fov*((x+camx)/(z+camz)))+sx,int(fov*((y+camy)/(z+camz)))+sy),color,15-int(((camz)/50)*10))
else:
dx=-999
dy=-999
else:
if(viewdistq!=False and viewdistq!=True):
if(viewdist-int(((camz)/50)*10)>1):
if(math.sqrt(((dx+sx)-int(fov*((x+camx)/(z+camz)))+sx)^2+((dy+sy)-int(fov*((y+camy)/(z+camz)))+sy)^2)<30):
line((dx+sx,dy+sy),(int(fov*((x+camx)/(z+camz)))+sx,int(fov*((y+camy)/(z+camz)))+sy),color,1)
elif(viewdistq==True):
if(150-int(((camz)/50)*10)>1):
if(math.sqrt(((dx+sx)-int(fov*((x+camx)/(z+camz)))+sx)^2+((dy+sy)-int(fov*((y+camy)/(z+camz)))+sy)^2)<30):
line((dx+sx,dy+sy),(int(fov*((x+camx)/(z+camz)))+sx,int(fov*((y+camy)/(z+camz)))+sy),color,1)
else:
if(math.sqrt(((dx+sx)-int(fov*((x+camx)/(z+camz)))+sx)^2+((dy+sy)-int(fov*((y+camy)/(z+camz)))+sy)^2)<30):
line((dx+sx,dy+sy),(int(fov*((x+camx)/(z+camz)))+sx,int(fov*((y+camy)/(z+camz)))+sy),color,1)
dx=-999
dy=-999
else:
dx=-999
dy=-999
else:
dx=int(fov*((x+camx)/(z+camz)))
dy=int(fov*((y+camy)/(z+camz)))
except:
dx=-999
dy=-999
def objover_3d_wire():
global dx
global dy
dx=-999
dy=-999
goto(0,0,0)
goto(-20,20,0)
goto(20,20,0)
goto(20,-20,0)
goto(-20,-20,0)
goto(-20,20,0)
goto(-20,20,-10)
goto(-20,-20,-10)
goto(-20,-20,0)
goto(-20,-20,-10)
goto(20,-20,-10)
goto(20,20,-10)
goto(-20,20,-10)
goto(-20,20,-10)
goto(-20,20,0)
goto(20,20,0)
goto(20,-20,0)
goto(20,-20,-10)
goto(20,20,-10)
goto(-20,20,-10)
goto(-20,-20,-10)
goto(-20,-20,0)
goto(-20,20,0)
goto(20,20,0)
goto(20,20,-10)
goto(-20,20,-10)
goto(-20,20,0)
goto(0,0,0)
dx=-999
dy=-999
def objover_3d_fill():
global dx
global dy
dx=-999
dy=-999
goto(0,0,0)
goto(0,0,0)
filly=15
c=0
while(c<35):
goto(-20,filly,0)
goto(20,filly,0)
goto(0,0,0)
dx=-999
dy=-999
filly-=1
c+=1
goto(0,0,0)
filly=15
c=0
while(c<35):
goto(-20,filly,-10)
goto(20,filly,-10)
goto(0,0,0)
goto(0,0,0)
dx=-999
dy=-999
filly-=1
c+=1
goto(0,0,0)
filly=15
c=0
while(c<35):
goto(20,filly,-10)
goto(20,filly,0)
goto(0,0,0)
dx=-999
dy=-999
filly-=1
c+=1
goto(0,0,0)
filly=15
c=0
while(c<35):
goto(-20,filly,-10)
goto(-20,filly,0)
goto(0,0,0)
dx=-999
dy=-999
filly-=1
c+=1
goto(0,0,0)
filly=20
c=0
while(c<40):
goto(filly,20,-10)
goto(filly,20,0)
goto(0,0,0)
dx=-999
dy=-999
filly-=1
c+=1
goto(0,0,0)
filly=20
c=0
while(c<40):
goto(filly,-20,-10)
goto(filly,-20,0)
goto(0,0,0)
dx=-999
dy=-999
filly-=1
c+=1
goto(-20,20,0)
goto(0,0,0)
goto(0,0,0)
dx=-999
dy=-999
def d3_cube(x,y,z,fillc,outc):
global camx
global camy
global camz
global color
view=False
if(viewdist!=False and viewdist!=True and viewdist!=None and viewdist!='' and viewdist!=' '):
viewdista=viewdist
elif(viewdist==False):
viewdista=None
else:
viewdista=150
camx=X+x
camy=Y+(y/1.08)
camz=Z+z
if(camx>-300):
if(camx<300):
if(camz>10):
if(viewdista!=None):
if(camz<viewdista):
view=True
else:
view=False
else:
view=True
if(view==True):
if(quality==4):
color=fillc
objover_3d_fill()
color=outc
objover_3d_wire()
if(quality==3):
color=outc
objover_3d_wire()
color=fillc
objover_3d_fill()
if(quality==2):
color=fillc
objover_3d_fill()
if(quality==1):
color=outc
objover_3d_wire()