三维球体-初级程序-极语言教程
//清单.xml代码:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /></dependentAssembly></dependency> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges></security></trustInfo></assembly>
//窗体代码:
整数 窗体;
程序资源 24,"清单.xml";
程序段 加载窗体
整数 左=(桌面.宽-656)>>1,上=(桌面.高-686)>>1;
窗体=创建窗口($200,程序.名称,"三维球体-按住左键拖动,滚轮缩放",$10C80000,左,上,656,686,0,0,0,0);
窗体启动;读取消息
结束
程序段 左键点击(编号)
{}
//程序代码:
正数 左点,上点,右点,下点,按下;浮点 上,下,左,右; 程序段 窗体消息(窗口,消息,参数,数据) 判断(消息)为 窗口关闭{停止(0)} 为 滚轮转动{缩放调整(参数)} 为 鼠标移动{数据->@右点;缩放调整(参数)数据->@左点} 为 按下左键{按下=1;数据->@左点}为 释放左键{按下=0} 为 单击左键{左键点击(参数)} 否则 处理窗口(窗口,消息,参数,数据) 结束 整数 设备,绿刷,白刷,红笔,白笔,横向,竖向,左边,上边,半径=300;小数 角度=0.01745329 ,坐标={0,0,0,0.3433, 0, 0.9392, 0.1061, 0.3265, 0.9392, -0.2777, 0.2018, 0.9392, -0.2777, -0.2018, 0.9392, 0.1061, -0.3265, 0.9392, 0.6866, 0, 0.7271, 0.7926, -0.3265, 0.5149, 0.9643, -0.2018, 0.1716, 0.9643, 0.2018, 0.1716, 0.7926, 0.3265, 0.5149, 0.2122, 0.653, 0.7271, 0.5554, 0.653, 0.5149, 0.4899, 0.8547, 0.1716, 0.1061, 0.9794, 0.1716, -0.0656, 0.8547, 0.5149, -0.5554, 0.4035, 0.7271, -0.4494, 0.73, 0.5149, -0.6615, 0.73, 0.1716, -0.8987, 0.4035, 0.1716, -0.8332, 0.2018, 0.5149, -0.5554, -0.4035, 0.7271, -0.8332, -0.2018, 0.5149, -0.8987, -0.4035, 0.1716, -0.6615, -0.73, 0.1716, -0.4494, -0.73, 0.5149, 0.2122, -0.653, 0.7271, -0.0656, -0.8547, 0.5149, 0.1061, -0.9794, 0.1716, 0.4899, -0.8547, 0.1716, 0.5554, -0.653, 0.5149, -0.5554, 0.653, -0.5149, -0.4899, 0.8547, -0.1716, -0.1061, 0.9794, -0.1716, 0.0656, 0.8547, -0.5149, -0.2122, 0.653, -0.7271, 0.4494, 0.73, -0.5149, 0.6615, 0.73, -0.1716, 0.8987, 0.4035, -0.1716, 0.8332, 0.2018, -0.5149, 0.5554, 0.4035, -0.7271, 0.8332, -0.2018, -0.5149, 0.8987, -0.4035, -0.1716, 0.6615, -0.73, -0.1716, 0.4494, -0.73, -0.5149, 0.5554, -0.4035, -0.7271, 0.0656, -0.8547, -0.5149, -0.1061, -0.9794, -0.1716, -0.4899, -0.8547, -0.1716, -0.5554, -0.653, -0.5149, -0.2122, -0.653, -0.7271, -0.7926, -0.3265, -0.5149, -0.9643, -0.2018, -0.1716, -0.9643, 0.2018, -0.1716, -0.7926, 0.3265, -0.5149, -0.6866, 0, -0.7271, -0.1061, 0.3265, -0.9392, 0.2777, 0.2018, -0.9392, 0.2777, -0.2018, -0.9392, -0.1061, -0.3265, -0.9392, -0.3433, 0, -0.9392} 字节组 位组[1,2, 3, 4, 5, 1, 6, 7, 30, 26, 5, 4, 21, 25, 27, 26, 30, 7, 8, 9, 10, 6, 10, 12, 13, 14, 15, 11, 12, 11, 2, 3, 16, 17, 15, 17, 18, 19, 20, 16, 20, 22, 21, 22, 23, 24, 25, 27, 28, 47, 28, 29, 30, 29, 43, 42, 8, 9, 38, 37, 13, 14, 33, 32, 18, 19, 53, 52, 23, 24, 48, 47, 46, 50, 46, 44, 45, 41, 39, 38, 37, 36, 34, 35, 31, 54, 31, 35, 56, 35, 34, 33, 32, 31, 35, 34, 36, 40, 57, 40, 36, 34, 36, 40, 39, 41, 42, 43, 44, 45, 58, 59, 50, 49, 48, 49, 51, 52, 53, 54, 55, 60, 56, 57, 58, 59, 60, 55, 51]; 程序段 窗体启动 设备=取设备(窗体) 绿刷=创建画刷($C000) 白刷=创建画刷($FFFFFF) 红笔=创建画笔(0,3,$30FF) 白笔=创建画笔(0,1,$FFFFFF) 开启线程(@计算位置,0,120) 结束 程序段 绘制物体 小数 横=角度*横向,竖=角度*竖向; 左=(横)余;右=(横)正;上=(竖)余;下=(竖)正; 整数 数=1,值=12;选择对象(设备,白刷)选择对象(设备,白笔) 画方块(设备,0,0,656,686)选择对象(设备,绿刷) 选择对象(设备,红笔)计算坐标(12)移到(设备,左边,上边) 循环{计算坐标(位组(数)*12)画线(设备,左边,上边)数++}(数=129)数=0 循环{计算坐标(值)画椭圆(设备,左边-10,上边-10,左边+10,上边+10)值+12;数++}(数=60) 结束 程序段 计算位置(毫秒) 循环{延时(毫秒)如果(按下=0){绘制物体 横向++;如果(横向>=360)横向=0 竖向++;如果(竖向>=360)竖向=0}} 结束 程序段 缩放调整(参数) 判断(参数) 为 1{如果(左点>右点)竖向-3如果(左点<右点)竖向+3 如果(上点>下点)横向+2如果(上点<下点)横向-2} 为 7864320半径+5为 -7864320半径-5 否则 返回;绘制物体 结束; 程序段 计算坐标(位置) 小数 勾,股,纵,竖,横;传送内存(@横,@坐标+位置,12) 勾=横*上 + 竖*下;股=横*下*右 - 竖*上*右 + 纵*左; 左边=勾*半径;左边+半径+20;上边=股*半径;上边+半径+30; 结束