投篮c语言程序,C语言300行-投篮

这篇博客介绍了如何使用C语言编写一个300行代码的投篮模拟程序,包括角度和速度控制,以及物体移动的逻辑。程序涉及到图形界面、速度调整、物体运动轨迹的计算等元素。
摘要由CSDN通过智能技术生成

《C语言300行-投篮》由会员分享,可在线阅读,更多相关《C语言300行-投篮(7页珍藏版)》请在人人文库网上搜索。

1、include stdio.h#ifdef __APPLE__#include #else#include #endif#include #include #include #include #include static double a=0;static double b=0.2;static double t=0;static double t1=0;static double v=0;static double i=0;static double m=0;static double n=0;static double p,q,r,r1=1;static void resize(int 。

2、width,int height)/重绘回调函数const float ar=(float)width/(float)height;glViewport(0,0,width,height);/利用函数glViewport定义视区glMatrixMode(GL_PROJECTION);/投影矩阵glLoadIdentity();/ 重置坐标系统,使投影变换复位glFrustum(-ar,ar,-1.0,1.0,2.0,100.0);/利用函数glFrustum定义修剪区glMatrixMode(GL_MODELVIEW);glLoadIdentity();static void display(。

3、void)/显示回调glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);/清除颜色缓冲区和深度缓冲区t=t+t1*0.0001;glColor3d(1,0.6,0.6);/画图颜色灰红/绘制一个实心球,默认原点在屏幕中心与照相机重合glPushMatrix();glTranslated(-3+0.5*cos(a),-0.6&#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值