随笔分类 -  各种程序编写

摘要:首先我们看看字符串的性质: 可交换: CW->WOOC->WC(任何字符串都满足) 表示结果和顺序无关 比如COCWOCWOWWO可以转化为C*3,W*4,O*4,这样的情况下可以直接消掉一大堆(变成c*0/1,O*0/1,W*0/1)这样共8种情况,直接枚举发现只有C、OW满足要求,所以只需要c、 阅读全文
posted @ 2022-04-17 18:12 steven-eleven 阅读(208) 评论(0) 推荐(0)
摘要:简简单单 代码: import pyglet as p from pyglet.gl import * win=p.window.Window(800,800) x=0 y=0 z=0 xs=0.1 ys=0.1 zs=0.1 s=1 pos = [0, 0, -20] rot_y = 0 rot_ 阅读全文
posted @ 2022-03-22 11:49 steven-eleven 阅读(136) 评论(0) 推荐(0)
摘要:在我们编游戏时,经常会用到一个无限循环,这就叫游戏循环。 先用@win.event试试 import pyglet as p win=p.window.Window(800,600) @win.event def on_draw(): print(1) #p.clock.schedule_inter 阅读全文
posted @ 2022-03-06 18:14 steven-eleven 阅读(440) 评论(0) 推荐(0)
摘要:这次讲讲图形的旋转和批量渲染(rotate、batch) 1:图形旋转 先看看上次的代码中的一段: glRotatef(rot_y, 0, 1, 0) glRotatef(rot_z,0,0,1) glRotatef(rot_x,1,0,0) 这就是旋转的代码,函数是glRotatef,第一个参数是 阅读全文
posted @ 2022-02-27 21:15 steven-eleven 阅读(965) 评论(0) 推荐(0)
摘要:某一天,我突然喜欢上了3D,在一些scratch教程中见过一些3D引擎,找了一个简单的,结果z轴太大了,于是网上一搜,就发现了pyglet 还是先讲如何启动一个窗口 先看看官网: Creating a window If the Window constructor is called with n 阅读全文
posted @ 2022-02-22 20:29 steven-eleven 阅读(1616) 评论(0) 推荐(0)