我正在练习Arcade Library进行2D 游戏开发。但是我的第一个程序以错误告终!
我想用 Python 中易于学习的Arcade 库制作我的第一个 2D 游戏- 一个快乐的笑脸 -。
import arcade
# set constants for the screen size:
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600
# open the window, set screen size & dimension:
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Hello, World! [Smiley]")
# set the bgcolor to white:
arcade.set_background_color(arcade.color.WHITE)
# start the render process, this must done before any drawing commands:
arcade.start_render()
# draw the face:
x, y, r = 300, 300, 200
arcade.draw_circle_filled(x, y, r, arcade.color.YELLOW)
# draw the right eye:
x = 370
y = 350
r = 20
arcade.draw_circle_filled(x, y, r, arcade.color.BLACK)
# draw the left eye:
x = 230
y = 350
r = 20
arcade.draw_circle_filled(x, y, r, arcade.color.BLACK)
# draw the smile:
x = 300
y = 280
width = 120
height = 100
start_angle = 190
end_angle = 350
arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK, start_angle, end_angle)
# finish drawing and display the result:
arcade.finish_render()
# keep the window open until the user hits the 'close' button:
arcade.run()
我期待一个“带微笑的黄色表情符号”。但我遇到了一个意外错误:
Start
Start
Traceback (most recent call last):
File "E:/Python/#Programs/arcade_pract/Hello, arcade!.py", line 18, in <module>
arcade.draw_circle_filled(x, y, r, arcade.color.YELLOW)
File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\draw_commands.py", line 629, in draw_circle_filled
draw_ellipse_filled(center_x, center_y, width, height, color, num_segments=num_segments)
File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\draw_commands.py", line 696, in draw_ellipse_filled
_generic_draw_line_strip(point_list, color, gl.GL_TRIANGLE_FAN)
File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\draw_commands.py", line 795, in _generic_draw_line_strip
fragment_shader=line_fragment_shader,
File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\shader.py", line 226, in program
(fragment_shader, GL_FRAGMENT_SHADER)
File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\arcade\shader.py", line 111, in __init__
self.prog_id = prog_id = glCreateProgram()
File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\pyglet\gl\lib_wgl.py", line 107, in __call__
return self.func(*args, **kwargs)
File "C:\Users\AVD\AppData\Roaming\Python\Python37\site-packages\pyglet\gl\lib.py", line 64, in MissingFunction
raise MissingFunctionException(name, requires, suggestions)
pyglet.gl.lib.MissingFunctionException: glCreateProgram is not exported by the available OpenGL driver. VERSION_2_0 is required for this functionality.
Warning: Anti-aliasing not supported on this computer.