汇编语言实现烟花效果

合集下载

c++语言烟花燃放代码

c++语言烟花燃放代码

c++语言烟花燃放代码以下是一个简单的C++语言烟花燃放代码示例:c复制代码#include<iostream>#include<windows.h>// 引入Windows头文件using namespace std;int main(){// 定义烟花的颜色和位置int colors[] = { 0, 0, 255, 0, 0, 255, 0, 0, 255 }; // 蓝色烟花int positions[] = { 100, 100, 200, 100, 200, 200, 300, 100, 300 }; // 烟花位置// 设置画布大小和背景颜色int width = 400;int height = 400;int background = RGB(255, 255, 255); // 白色背景// 创建画布HDC hdc = GetDC(NULL); // 获取屏幕设备上下文HBRUSH hBrush = CreateSolidBrush(background); // 创建实心画刷HBRUSH oldBrush = (HBRUSH)SelectObject(hdc, hBrush); // 选择画刷到设备上下文Rectangle(hdc, 0, 0, width, height); // 绘制矩形画布// 绘制烟花for (int i = 0; i < 9; i++) {SetPixel(hdc, positions[i], positions[i+1], colors[i]); // 在指定位置绘制像素点Sleep(100); // 暂停100毫秒,控制烟花燃放速度}// 释放资源并关闭程序SelectObject(hdc, oldBrush); // 选择原来的画刷到设备上下文DeleteObject(hBrush); // 删除画刷ReleaseDC(NULL, hdc); // 释放设备上下文system("pause"); // 暂停程序,等待用户按下任意键退出return0;}该代码使用Windows API函数绘制了一个简单的蓝色烟花,通过循环在指定位置绘制像素点来模拟烟花的爆炸效果。

小学四年级编程烟花

小学四年级编程烟花

小学四年级编程烟花
第一步
添加一个城市的背景。

第二步
创建烟花Rocket角色,做出八个造型。

第一个造型命名为C1,代表升空的烟花。

当这个小红点C1到达某个随机的位置,再将它切换到其他七个造型之一,这样就模拟出烟花绽放的效果。

再加一些简单的图形效果让整个过程更加真实。

烟花程序如下:
开始将自己隐藏,然后重复执行,每隔一个随机时间创建一个克隆体。

由于原角色是隐藏的,所以它的克隆体一开始都是隐藏的。

克隆体程序如下:
原角色烟花Rocket的克隆体,设置造型为Cl❶,即代表烟花的小红点造型,然后随机移动到舞台的底部❷并显示❸,然后随机滑动到建筑物的上方❹。

1到4步程序模拟了烟花发射升空的场景。

下面来模拟小红点到达预定位置后爆炸的场景,首先克隆体弹奏一段很短的鼓声❺模拟爆炸的声音。

由于后面要放大烟花,我们设置一个初始大小,并将其随机切换到一个烟花效果❻,最后进入重复执行❼逐渐放大烟花,每次重复都将大小增加4。

重复完毕后删除克隆体本身❽。

烟花c语言代码

烟花c语言代码

烟花c语言代码
1 烟花c语言代码
烟花是一种精美的现代艺术表演形式,用烟花在空中绘制出来的
美丽图形在夜空中显得十分惊艳夺目。

它代表着一种外在的美丽,代
表着缤纷的多彩和永恒的爱。

烟花的动态形象常常令人惊叹,让人叹
为观止,尤其是一些展示了复杂图形的烟花,更是让人惊叹不已。

烟花能够通过编写程序来实现它的美丽外观。

其中最常用的编程
语言是C语言,它的执行效率和可divusability被广泛而深入地应用
于各种复杂场景中。

C语言可用来创建复杂的烟花演示,通过控制它们的展示顺序,让烟花呈现出来的变化效果更加梦幻和惊人。

要想让C语言实现非凡的烟花外观,首先要理解烟花的制作过程。

一次烟花表演需要数千个不同形状和颜色的烟花,它们被装入火箭和
枪中,以不同的发射角度进行发射,从而在空中绘制出不同的图形。

对于C语言而言,需要通过大量的代码来模拟火箭的发射过程(如设
定发射姿态,模拟烟花的发射力等)。

通过设定发射间隔和发射数量,还可以实现不同图形的烟花效果。

此外,在编写程序时,也要熟悉C语言的变量定义,函数定义,
以及并行效率。

C语言可以提升对烟花表演的控制能力,使之更加润滑的执行烟花的发射,从而使烟花的展示效果更加精致动态,让烟花的
外观升华成一种艺术表演外观。

总的来说,通过编写c语言的程序,可以实现不同形状与复杂性的烟花表演,它可以提升对燃放烟花的控制能力,使之更加润滑的执行,从而获得更加生动多彩的烟花效果。

c语言烟花燃放代码

c语言烟花燃放代码

c语言烟花燃放代码烟花燃放是人们在庆祝节日或者特殊场合时常见的场景。

而在计算机编程领域,我们也可以通过代码来实现烟花燃放的效果。

在本文中,我将使用C语言编写一个简单的烟花燃放代码,并解释其实现原理。

我们需要了解烟花燃放的基本原理。

烟花燃放时,会有一连串的爆炸效果,每个爆炸都会产生一团花火。

这些花火会以不同的速度和方向向外扩散,并在空中绽放出五彩斑斓的光芒。

在代码实现中,我们可以使用图形库来模拟烟花燃放的效果。

在C 语言中,常用的图形库有graphics.h和SDL等。

在本文中,我们将使用graphics.h库来实现烟花燃放。

我们需要导入graphics.h库,并初始化图形窗口。

代码示例如下:```#include <graphics.h>int main(){int gd = DETECT, gm;initgraph(&gd, &gm, "");// 烟花燃放代码closegraph();return 0;}```接下来,我们可以使用一系列函数来实现烟花燃放的效果。

首先,我们需要定义一个结构体来表示烟花的属性,包括位置、颜色和速度等。

代码示例如下:```struct Firework{int x;int y;int color;int speed;};```然后,我们可以定义一个函数来生成烟花的初始属性。

这个函数可以随机生成烟花的位置、颜色和速度等。

代码示例如下:```void generateFirework(struct Firework* firework){firework->x = random(getmaxx());firework->y = getmaxy();firework->color = random(15) + 1;firework->speed = random(10) + 1;}```接下来,我们可以定义一个函数来更新烟花的位置。

c语言浪漫烟花代码

c语言浪漫烟花代码

c语言浪漫烟花代码C语言是一门经典的编程语言,它可以用来实现各种功能,包括制作浪漫烟花效果。

下面是一段简单的C语言浪漫烟花代码:#include <stdio.h>#include <stdlib.h>#include <math.h>#include <time.h>#define WIDTH 80#define HEIGHT 25void setColor(int color) {HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleTextAttribute(handle, color);}int main() {int x, y, i;float dx, dy, v, t, g = 9.8;srand((unsigned)time(NULL));x = rand() % WIDTH;y = HEIGHT - 1;dx = (float)(rand() % 10 - 5) / 10;dy = (float)(rand() % 10 - 1) / 10;v = sqrt(dx * dx + dy * dy);t = 0;while (y >= 0) {x += dx * v * t;y -= dy * v * t - 0.5 * g * t * t;setColor(rand() % 15 + 1);for (i = 0; i < HEIGHT - y; i++) {printf('');}for (i = 0; i < x; i++) {printf(' ');}printf('*');Sleep(30);system('cls');t += 0.1;}return 0;}在这段代码中,我们使用了Windows API中的一些函数来设置控制台文字的颜色,并且使用了随机数发生器来随机生成烟花的起始位置、方向和速度。

放烟花游戏编程实现

放烟花游戏编程实现

放烟花游戏编程实现在游戏开发领域,实现一个放烟花的游戏可以为玩家带来乐趣和刺激。

本文将介绍如何编写一个放烟花游戏,并提供关键的代码和详细的实现步骤。

首先,我们需要创建一个游戏窗口,以便玩家能够看到游戏的画面。

在大多数游戏引擎中,可以使用图形库来实现这一功能。

下面是一个使用Python编写的例子:```pythonimport pygamefrom pygame.locals import *# 定义窗口的宽度和高度WIDTH, HEIGHT = 800, 600# 初始化pygame库pygame.init()# 创建游戏窗口screen = pygame.display.set_mode((WIDTH, HEIGHT))pygame.display.set_caption("放烟花游戏")# 游戏主循环running = Truewhile running:# 处理游戏事件for event in pygame.event.get():if event.type == QUIT:running = False# 更新游戏画面pygame.display.flip()# 退出游戏pygame.quit()```在上面的代码中,我们使用了pygame库来创建游戏窗口。

通过初始化pygame库,我们可以使用其提供的各种功能来实现一个完整的游戏。

在游戏的主循环中,处理游戏事件并更新游戏画面。

接下来,我们需要实现一个能够放烟花的功能。

在这个游戏中,玩家可以通过按下某个键来触发放烟花的效果。

下面是一个简单的实现思路:1. 创建一个烟花的类,包含烟花的位置、颜色、大小等属性。

2. 当玩家按下触发键时,在玩家当前位置创建一个新的烟花对象,并将其添加到一个烟花列表中。

3. 在游戏的主循环中,更新并绘制每个烟花对象。

下面是一个展示如何实现放烟花功能的代码示例:```pythonimport pygamefrom pygame.locals import *import random# 定义窗口的宽度和高度WIDTH, HEIGHT = 800, 600# 初始化pygame库pygame.init()# 创建游戏窗口screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("放烟花游戏")# 定义烟花的类class Firework:def __init__(self, x, y, color):self.x = xself.y = yself.color = colorself.size = 5self.speed = random.randint(1, 5)def update(self):self.y -= self.speeddef draw(self):pygame.draw.circle(screen, self.color, (self.x, self.y), self.size) # 创建烟花列表fireworks = []# 游戏主循环running = Truewhile running:# 处理游戏事件for event in pygame.event.get():if event.type == QUIT:running = Falseelif event.type == KEYDOWN:if event.key == K_SPACE:# 在玩家当前位置创建一个新的烟花对象x, y = pygame.mouse.get_pos()color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))fireworks.append(Firework(x, y, color))# 清空屏幕screen.fill((0, 0, 0))# 更新和绘制烟花for firework in fireworks:firework.update()firework.draw()# 更新游戏画面pygame.display.flip()# 退出游戏pygame.quit()```在上面的代码中,我们定义了一个Firework类来表示烟花对象。

c语言中烟花程序

c语言中烟花程序

以下是一个简单的C语言烟花程序示例,使用了随机数生成器来模拟烟花效果:```c#include <stdio.h>#include <stdlib.h>#include <time.h>#define WIDTH 80 // 窗口宽度#define HEIGHT 20 // 窗口高度#define FIREWORKS 50 // 烟花数量int main() {int x, y; // 烟花的坐标int delay = 100; // 每次更新烟花的间隔时间(毫秒)int colors[4] = {3, 6, 9, 12}; // 烟花的颜色int i, j; // 循环变量// 初始化随机数生成器srand((unsigned int) time(NULL));// 主循环,模拟烟花效果while (1) {// 清空屏幕for (i = 0; i < HEIGHT; i++) {for (j = 0; j < WIDTH; j++) {printf(" ");}printf("\n");}// 绘制烟花for (i = 0; i < FIREWORKS; i++) {x = rand() % WIDTH; // 随机生成烟花的横坐标y = rand() % HEIGHT; // 随机生成烟花的纵坐标printf("\033[48;2;%d;%d;%dm", colors[rand() % 4], colors[rand() % 4], colors[rand() % 4]); // 随机生成烟花的颜色printf("*\n"); // 在指定位置绘制一个星号,表示烟花}// 等待一段时间后清除屏幕上的烟花,并重新绘制新的烟花usleep(delay * 1000); // 等待一段时间(毫秒)}return 0;}```在这个示例中,我们使用了一个无限循环来模拟烟花效果。

processing烟花编程代码

processing烟花编程代码

processing烟花编程代码烟花效果是一个非常有趣和美丽的视觉效果,可以通过Processing编程语言来实现。

在Processing中,你可以使用图形和动画功能来模拟烟花的效果。

下面是一个简单的烟花效果的示例代码:java.int particles = 100;Particle[] p = new Particle[particles];void setup() {。

size(800, 600);for (int i = 0; i < particles; i++) {。

p[i] = new Particle();}。

}。

void draw() {。

background(0);for (int i = 0; i < particles; i++) {。

p[i].update();p[i].show();}。

}。

class Particle {。

float x;float y;float speedX;float speedY;Particle() {。

x = width/2;y = height;speedX = random(-2, 2); speedY = random(-5, -1); }。

void update() {。

x += speedX;y += speedY;speedY += 0.2;}。

void show() {。

stroke(255);point(x, y);}。

}。

这个示例代码创建了一个名为Particle的类来表示烟花的粒子,然后在setup()函数中初始化了一定数量的粒子,并在draw()函数中更新和显示这些粒子。

每个粒子具有位置和速度属性,并且会在屏幕上以不同的速度移动。

你可以根据自己的想法和创意来修改和扩展这个示例代码,添加颜色、尾迹、爆炸效果等,以实现更加逼真和丰富的烟花效果。

希望这个示例能够帮助你开始使用Processing来编写烟花效果的代码。

用c语言编写动态烟花代码

用c语言编写动态烟花代码

用c语言编写动态烟花代码动态烟花是一种非常有趣的动画效果,它通过不断改变每个粒子的位置和颜色来呈现出烟花的爆炸效果。

下面我们来看一下如何使用c语言进行动态烟花的编写。

首先,我们需要定义一个表示粒子的结构体,它包含了粒子的位置(x,y),速度(vx,vy),和颜色(r,g,b)等信息。

具体的代码如下:```ctypedef struct particle {float x, y;float vx, vy;int r, g, b;} particle;```接下来,我们需要初始化一堆粒子,并随机赋予它们速度和颜色。

具体的代码如下:```cvoid init_particles(particle* particles, int num_particles) {for (int i = 0; i < num_particles; i++) {particles[i].x = SCREEN_WIDTH / 2;particles[i].y = SCREEN_HEIGHT / 2;particles[i].vx = (float)rand() / RAND_MAX * 10 - 5;particles[i].vy = (float)rand() / RAND_MAX * 10 - 5;particles[i].r = rand() % 256;particles[i].g = rand() % 256;particles[i].b = rand() % 256;}}```然后,我们需要在循环中不断更新每个粒子的位置,并绘制出来。

在更新粒子位置时,我们需要考虑粒子的速度和重力等因素。

具体的代码如下:最后,在主函数中,我们需要不断调用以上两个函数进行更新并重绘烟花。

具体的代码如下:。

c语言礼花源代码直接复制

c语言礼花源代码直接复制

c语言礼花源代码直接复制以下是一份C语言礼花源代码,可以直接复制使用: ```#include <stdio.h>void printLine(int num) {for (int i = 0; i < num; i++) {printf('*');}printf('');}void printBlock(int num) {for (int i = 0; i < num; i++) {printLine(num - i);}}void printTriangle(int num) {for (int i = 0; i < num; i++) {printLine(i + 1);}}void printRect(int width, int height) {for (int i = 0; i < height; i++) { printLine(width);}}int main() {int choice;int num, width, height;printf('请选择礼花形状:');printf('1. 倒三角形');printf('2. 正三角形');printf('3. 长方形');scanf('%d', &choice);switch (choice) {case 1:printf('请输入行数:');scanf('%d', &num);printBlock(num);break;case 2:printf('请输入行数:');scanf('%d', &num);printTriangle(num);break;case 3:printf('请输入宽度和高度:');scanf('%d %d', &width, &height);printRect(width, height);break;default:printf('输入错误!');break;}return 0;}```这段代码可以根据用户输入的选项来打印不同形状的礼花。

C语言实现放烟花的程序

C语言实现放烟花的程序

C语⾔实现放烟花的程序这是⼀个利⽤C语⾔编写放烟花的程序(同时也可以播放⾳乐),供⼤家参考,具体内容如下代码如下#pragma once#include<stdio.h>#include<graphics.h> //图形界⾯库头⽂件#include<math.h> //计算圆形的轨迹坐标#include<conio.h>#include<time.h>#include<stdlib.h>#include<mmsystem.h>#pragma comment(lib,"winmm.lib")//#include 包含头⽂件//#pragma comment(lib."⽂件名称")包含库⽂件constexpr auto WND_WIDTH = 1000;constexpr auto WND_HEIGHT = 600;constexpr auto PI = 3.141592653589793238;constexpr auto NUM = 14;/***********结构****************/struct JET //烟花弹{int x, y; //发射点坐标int hx, hy; //最⾼点坐标爆炸坐标int height; //⾼度最⾼点y 发射点y的差值bool isshoot; //是否发射状态DWORD t1, t2, dt; //保存时间时间可以⽤来描述发射速度IMAGE img[2]; //保存烟花⼀明⼀暗的图⽚byte n : 1; //保存烟花弹的明暗状态位段//字节为单位 int 4 char 1 n⼀个位 0-1}jet[NUM]; //结构体数组13 img这个数组struct FIRE{int r;int max_r;int x, y;int cen_x, cen_y;int width, height;int xy[240][240];bool show;bool draw;DWORD t1, t2, dt;}fire[NUM];void welcome();void init(int i);void loadimages();void choice(DWORD& t1);void shoot();void Show(DWORD* pMem);void clss(int a);void delay(int a);void detabase(int a);int main(){//res 1.wavPlaySound(L"sound.dll", NULL, SND_LOOP | SND_FILENAME | SND_ASYNC);//mp3播放//mciSendString(L"open 1.mp3 alias bkmusic", NULL, 0, NULL);//mciSendString(L"play bkmusic repeat", NULL, 0, NULL);int a;for (a = 0; a < 5; a++){detabase(a);delay(100000);clss(1);}delay(500000);initgraph(WND_WIDTH, WND_HEIGHT); //init初始化 graph图形界⾯窗⼝srand((unsigned int)time(NULL));DWORD t1 = timeGetTime();DWORD* pMem = GetImageBuffer();//第⼀个界⾯welcome();//初始化for (int i = 0; i < NUM; i++){init(i);}loadimages();BeginBatchDraw();while (!_kbhit()){//Sleep(10);for (int i = 0; i < 1000; i++){for (int j = 0; j < 3; j++){int px1 = rand() % 1000;int py1 = rand() % 600;if (py1 < 599){pMem[py1 * 1000 + px1] = pMem[py1 * 1000 + px1 + 1] = BLACK;}}}choice(t1);shoot();Show(pMem);EndBatchDraw();}return 0;}void welcome(){settextcolor(YELLOW);for (int i = 0; i < 50; i++){//圆⼼(500,300)半径150 60个均匀点的x,yint x = 500 + int(150 * sin(PI * 2 * i / 60));int y = 300 + int(150 * cos(PI * 2 * i / 60));cleardevice();settextstyle(i, 0, L"微软雅⿊");outtextxy(x - 100, y - 150, L"测试使⽤1234567890"); //在指定的位置去输出字符 outtextxy(x, y - 100, L"测试1234567890");Sleep(25);}//_getch(); //接收字符不回显直接接收Sleep(2000);cleardevice();settextstyle(25, 0, L"宋体");outtextxy(400, 150, L"1,");outtextxy(400, 200, L"2");outtextxy(400, 250, L"3,");outtextxy(400, 300, L"4,");outtextxy(400, 350, L"5");outtextxy(560, 400, L"---6");Sleep(3000);//_getch();}void init(int i){int r[14] = { 120,120,155,123,130,147,138,138,130,135,140,132,155,160 };int x[14] = { 120,120,110,117,110,93,102,102,110,105,100,108,110,132 };int y[14] = { 120,120,85,118,120,105,103,110,110,120,1201,04,85,145 };fire[i].x = 0;fire[i].y = 0;fire[i].width = 240;fire[i].height = 240;fire[i].max_r = r[i];fire[i].cen_x = x[i];fire[i].cen_y = y[i];fire[i].show = false;fire[i].dt = 5;fire[i].t1 = timeGetTime();fire[i].r = 0;//初始化烟花弹jet[i].x = 0;jet[i].y = 0;jet[i].hx = 0;jet[i].hy = 0;jet[i].height = 0;jet[i].t1 = timeGetTime(); //获取系统时间jet[i].dt = rand() % 10; //0-9的随机时间jet[i].n = 0;jet[i].isshoot = false;}void loadimages(){IMAGE fm, gm;loadimage(&fm, L"flower.dll", 3120, 240);for (int i = 0; i < NUM; i++){SetWorkingImage(&fm);getimage(&gm, i * 240, 0, 240, 240);SetWorkingImage(&gm);for (int a = 0; a < 240; a++){for (int b = 0; b < 240; b++){fire[i].xy[a][b] = getpixel(a, b);}}}IMAGE jetimg;loadimage(&jetimg, L"shoot.dll", 200, 50);//set设置 working正在⼯作的 image图⽚SetWorkingImage(&jetimg);for (int i = 0; i < NUM; i++){int n = rand() % 5; //0-4的随机数getimage(&jet[i].img[0], n * 20, 0, 20, 50);getimage(&jet[i].img[1], (n + 5) * 20, 0, 20, 50);}SetWorkingImage(NULL);}void choice(DWORD& t1){DWORD t2 = timeGetTime();if (t2 - t1 > 2) //2ms产⽣⼀个烟花弹{int n = rand() % 200; //0-199if (n < NUM && jet[n].isshoot == false && fire[n].show == false) {//重置烟花弹jet[n].x = rand() % (WND_WIDTH - 20);jet[n].y = rand() % 100 + 400; //450-549jet[n].hx = jet[n].x;jet[n].hy = rand() % 400; //0-399jet[n].height = jet[n].y - jet[n].hy;jet[n].isshoot = true;//nputimage(jet[n].x, jet[n].y, &jet[n].img[jet[n].n]);}t1 = t2;}}void shoot(){for (int i = 0; i < NUM; i++){jet[i].t2 = timeGetTime();if (jet[i].t2 - jet[i].t1 > jet[i].dt && jet[i].isshoot == true){putimage(jet[i].x, jet[i].y, &jet[i].img[jet[i].n]);if (jet[i].hy < jet[i].y){jet[i].n++; //0-1 明暗交替jet[i].y -= 5;}putimage(jet[i].x, jet[i].y, &jet[i].img[jet[i].n]);if (jet[i].y <= jet[i].hy){fire[i].y = jet[i].hy;fire[i].x = jet[i].hx;fire[i].show = true;jet[i].isshoot = false;}jet[i].t1 = jet[i].t2;}}}void Show(DWORD* pMem){int drt[16] = { 5,5,5,5,5,6,25,25,25,25,25,55,55,55,55,55 }; //dt for (int i = 0; i < NUM; i++){fire[i].t2 = timeGetTime();if (fire[i].t2 - fire[i].t1 > fire[i].dt && fire[i].show == true){if (fire[i].r < fire[i].max_r){fire[i].r++;fire[i].dt = drt[fire[i].r / 10];fire[i].draw = true;}if (fire[i].r >= fire[i].max_r - 1){fire[i].draw = false;init(i);}fire[i].t1 = fire[i].t2;}if (fire[i].draw){for (double a = 0; a <= 6.28; a += 0.01){int x1 = (int)(fire[i].cen_x + fire[i].r * cos(a));int y1 = (int)(fire[i].cen_y + fire[i].r * sin(a));if (x1 > 0 && x1 < fire[i].width && y1>0 && y1 < fire[i].height) {int b = fire[i].xy[x1][y1] & 0xff;int g = (fire[i].xy[x1][y1] >> 8) & 0xff;int r = (fire[i].xy[x1][y1] >> 16);int xx = (int)(fire[i].x + fire[i].r * cos(a));int yy = (int)(fire[i].y + fire[i].r * sin(a));if (r > 0x20 && g > 0x20 && b > 0x20 && xx > 0 && xx < 1000 && yy < 600 && yy>0) {pMem[yy * 1000 + xx] = BGR(fire[i].xy[x1][y1]);}}}fire[i].draw = true;}}}void clss(int a){system("cls");}void delay(int a){while (a){a--;}}void detabase(int a){switch (a){case 1:{//printf("■■■■■■■■■■■■■■■■■■■■■■■■■\n");printf(" ■■■■ \n");printf(" ■■■■■■■■■■■■\n");printf(" ■■■■■■■■■■■ \n");printf(" ■■■■■■■■■■■■■■ \n");printf(" ■■■■■■■■■■■■■■ \n");printf(" ■■■ \n");printf(" ■■■■■■ \n");printf(" ■■■■■■ \n");printf(" ■■■■■■ \n");printf("■■■■■■■■■■■■■■■■■■■■■■■\n");printf("■■■■■■■■■■■■■■■■■■■■■■■■\n");printf(" ■■■■■■ \n");printf(" ■■■■■■ \n");printf(" ■■■■■■■■■■■■■■■■ \n");printf(" ■■■■■■■■■■■■■■■■ \n");printf(" ■■■■■■ \n");printf(" ■■■■■■■■ \n");printf(" ■■■■■■■■■■■ \n");printf(" ■■■■■■■■■■ \n");printf(" ■■■■■■■■■■■ \n");printf("■■■■■■■■■■ \n");printf("■■■■■■■■ \n");printf(" ■■■■■■■■■ \n");printf(" ■■■■■■■ \n");}break;case 2:{//printf("■■■■■■■■■■■■■■■■■■■■■■■■\n");printf(" ■■■ \n");printf(" ■■■ \n");printf(" ■■ \n");printf(" ■■■ \n");printf(" ■■■■■■■■■■■■■■■■■■■ \n");printf(" ■■■■■■■ \n");printf(" ■■■■■ \n");printf(" ■■■■■ \n");printf(" ■■■■■■ \n");printf("■■■■■■ \n");printf(" ■■■■■■■■■■■■■■■■■■■ \n");printf(" ■■■■■■■■■■■■■■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■ \n");printf("■■■■■■■■■■■■■■■■■■■■■■■■\n");printf("■■■■■■■■■■■■■■■■■■■■■■■■\n");printf(" ■■ \n");printf(" ■■ \n");printf(" ■■ \n");printf(" ■■ \n");printf(" ■■ \n");printf(" ■■ \n");printf(" ■■ \n");}break;case 3:{//printf("■■■■■■■■■■■■■■■■■■■■■■■■■\n"); printf(" ■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■■■■■■■■■■ \n");printf(" ■■■■■■■■■■■■■■ \n");printf(" ■■■■■■■■■■ \n");printf(" ■■■■■■■■■■ \n");printf("■■■■■■■■■■ \n");printf("■■■■■■■■■■■ \n");printf("■■■■■■■■ \n");printf("■■■■■■■■ \n");printf("■■■■■■■■■ \n");printf(" ■■■■■■■■■■■■■■■■■■\n");printf(" ■■■■■■■■■■■■■■\n");printf(" ■■■■■ \n");printf(" ■■■■■■ \n");printf(" ■■■■■■ \n");printf(" ■■■■■■ \n");printf(" ■■■■■■ \n");printf(" ■■■■■■■ \n");printf(" ■■■■■■■■ \n");printf(" ■■■■■■■■■ \n");printf(" ■■■■■■■■■■\n");printf(" ■■■■■■■ \n");printf(" ■■■ \n");}break;case 4:{//不⽤不⽤//printf("■■■■■■■■■■■■■■■■■■■■■■■■■\n"); printf(" ■■ \n");printf(" ■■■■■■■■■■■■■■■■ \n");printf(" ■■■■■■■■■■■■■■■■■■■ \n");printf(" ■■■ \n");printf(" ■■ \n");printf(" ■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■ \n");printf(" ■■■■■ \n");printf(" ■■■■■ \n");printf(" ■■■■■■■■■■■■■■■■■■■■■ \n");printf(" ■■■■■■■■ \n");printf(" ■■ \n");printf(" ■■ \n");printf(" ■■■ \n");printf(" ■■■■■■■■■ \n");printf(" ■■■■■■■■■ \n");printf(" ■■■■■■■■■ \n");printf(" ■■■■■■■■■ \n");printf(" ■■■■■■■■■ \n");printf(" ■■■■■ \n");printf(" ■■■■■ \n");printf(" ■■■■■ \n");printf(" ■■■■ \n");printf(" ■■ \n");}break;case 5:{printf("happy spring festival!");}break;}}以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。

python烟花绽放代码

python烟花绽放代码

python烟花绽放代码Python是一种高级编程语言,由于其简便性和实用性而备受青睐。

Python具有许多有趣而且实用的特点,其中之一就是能够编写炫彩的烟花绽放代码。

在这篇文档中,我将详细介绍如何编写Python烟花绽放代码,同时也会分享一些您可以使用的有用资源和技巧。

编写Python烟花绽放代码需要使用pygame模块,它是一个用于二维游戏开发的Python库。

在pygame模块的帮助下,您可以很容易地创建美丽的烟花效果。

首先安装pygame模块,输入以下命令:``` pip install pygame ```接下来,打开Python IDE,开始编写代码。

首先,让我们创建一个窗口,代码如下:``` import pygame import randompygame.init() screen_width = 800 screen_height = 600 screen =pygame.display.set_mode((screen_width,screen_height)) pygame.display.set_caption("Python Fireworks")clock = pygame.time.Clock() ```这段代码创建了一个pygame窗口,窗口的宽度和高度分别为800和600,标题被设置为“Python Fireworks”,并且我们还设置了时钟来控制帧速率,让我们的动画看起来更加顺滑。

接下来,我们需要定义一些函数来创建和渲染烟花。

这些函数负责在屏幕上显示炸裂的烟花效果。

这里我们可以定义一个名为create_firework的函数,它将生成随机位置的烟花,并返回烟花的位置,代码如下:``` def create_firework(): x,y =random.randint(100, screen_width-100),random.randint(100, screen_height-100) color = [random.randint(0, 255) for i in range(3)] sparks = [] for i in range(random.randint(10, 30)): sparks.append(create_spark(x, y, color)) return sparks ```在这个函数中,我们生成了一个随机的x和y坐标,并定义了一个名为color的随机颜色。

processing烟花编程代码

processing烟花编程代码

processing烟花编程代码标题:用Processing编写烟花绘制代码引言:编程是一门令人着迷的艺术,它可以创造出各种奇妙的效果。

今天我要介绍的是使用Processing编写的烟花绘制代码。

通过这个代码,我们可以创造出绚丽多彩、形态各异的烟花效果。

让我们一起来探索这个有趣的程序吧!代码实现:我们需要在Processing中创建一个窗口,设置画布的大小和背景颜色。

接下来,我们需要定义一个烟花类,用于生成烟花的各个属性和方法。

在烟花类中,我们可以定义烟花的位置、颜色、大小等属性,以及烟花的运动方法。

然后,我们需要创建一个烟花的数组,用于存储生成的烟花对象。

通过循环,我们可以在每一帧中创建新的烟花,并将其添加到数组中。

同时,我们还可以通过改变烟花的位置、颜色等属性,使其呈现出不同的效果。

接下来,我们需要在画布上绘制烟花。

通过遍历烟花数组,我们可以依次绘制每个烟花的形状和颜色。

通过使用Processing中的绘制函数,我们可以绘制出烟花的各个部分,如火花、烟雾等。

我们需要在每一帧中更新烟花的状态。

通过改变烟花的位置和大小等属性,我们可以实现烟花的运动效果。

同时,我们还可以通过改变烟花的颜色和形状等属性,使其呈现出不同的效果。

结语:通过使用Processing编写的烟花绘制代码,我们可以创造出绚丽多彩、形态各异的烟花效果。

这个程序不仅可以让我们欣赏到美丽的视觉效果,还可以让我们了解到编程的乐趣和挑战。

希望通过这个代码,大家能够对编程有更深入的了解,并能够创造出更多有趣的效果。

让我们一起享受编程的乐趣吧!。

c语言实现烟花表白代码

c语言实现烟花表白代码

c语言实现烟花表白代码烟花表白,是一种比较浪漫的表白方式。

如果能够用编程语言来实现这种浪漫场景,那就更有意义了。

本文将围绕“c语言实现烟花表白代码”展开,一步步地进行详细介绍。

1. 开始首先,打开编辑器(例如Visual Studio Code),新建一个c文件(例如love.c),输入以下头文件:# include <stdio.h># include <stdlib.h># include <time.h># include <conio.h># include <windows.h>其中,stdio.h是C语言的标准输入输出库头文件,stdlib.h包含了一些重要的函数和类型定义,time.h包含了计算机时间相关函数,conio.h是用于屏幕操作的库头文件,windows.h包含了windows操作系统相关的函数和类型。

2. 实现烟花接下来,我们需要实现烟花的效果。

输入以下代码:void fireworks(int x,int y,int color){HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);DWORD dw;CHAR_INFO ci={0};COORD pos={x,y};WORD _color=color;wsprintfA(ci.Char.AsciiChar,"%c",42);ci.Attributes=_color;SMALL_RECT rc={x,y,x,y};WriteConsoleOutput(hOut,&ci,(COORD){1,1},(COORD){0,0},&rc); FlushConsoleInputBuffer(hOut);Sleep(100);ci.Attributes=0;WriteConsoleOutput(hOut,&ci,(COORD){1,1},pos,&rc); FlushConsoleInputBuffer(hOut);}在这段代码中,我们使用了windows.h头文件中的功能来实现烟花效果。

好看的c语言程序烟花源代码

好看的c语言程序烟花源代码

好看的c语言程序烟花源代码烟花是人们新年、庆祝等节日最喜爱的庆祝道具之一,而用C语言编写的烟花程序更是酷炫、有趣,甚至具有一定的指导意义。

本程序采用的是Win32 API图形和多线程,实现了屏幕上多个烟花同时绽放、炫彩夺目的效果。

以下是程序代码:```include <stdio.h>include <windows.h>include <stdlib.h>include <time.h>define MAX_FIREWORKS 10define MAX_PARTICLES 100struct ParticleStruct {float x, y;float vx, vy;float brightness;};struct FireworkStruct {int x, y;int color;int particlesLeft;bool exploded;ParticleStruct particles[MAX_PARTICLES];};FireworkStruct fireworks[MAX_FIREWORKS];int screenHeight, screenWidth;HDC hDCMem;HBITMAP hBitmap;HBITMAP hOldBitmap;void InitializeFirework(int index) {fireworks[index].x = rand() % screenWidth;fireworks[index].y = screenHeight - 1;fireworks[index].color = RGB(rand() % 256, rand() % 256, rand() % 256);fireworks[index].particlesLeft = rand() % 101 + 100;for (int i = 0; i < MAX_PARTICLES; i++) {fireworks[index].particles[i].x =fireworks[index].x;fireworks[index].particles[i].y =fireworks[index].y;fireworks[index].particles[i].vx = (rand() % 11 - 5) / 10.0;fireworks[index].particles[i].vy = (rand() % 11 - 10) / 10.0;fireworks[index].particles[i].brightness = 1.0;}}void InitializeFireworks() {for (int i = 0; i < MAX_FIREWORKS; i++)InitializeFirework(i);}bool UpdateFirework(int index) {fireworks[index].y -= rand() % 6 + 3;if (fireworks[index].y < screenHeight / 4) { fireworks[index].exploded = true;for (int i = 0; i < MAX_PARTICLES; i++) { fireworks[index].particles[i].vx = 0; fireworks[index].particles[i].vy = 0; }}return true;}else {bool particleExists = false;for (int i = 0; i < MAX_PARTICLES; i++){fireworks[index].particles[i].vx *= 0.95; fireworks[index].particles[i].vy *= 0.95;fireworks[index].particles[i].x +=fireworks[index].particles[i].vx;fireworks[index].particles[i].y +=fireworks[index].particles[i].vy;fireworks[index].particles[i].brightness *=0.975;if (fireworks[index].particles[i].brightness > 0.0)particleExists = true;}fireworks[index].particlesLeft--;if (fireworks[index].particlesLeft == 0|| !particleExists) {InitializeFirework(index);return false;}return true;}}void UpdateFireworks() {for (int i = 0; i < MAX_FIREWORKS; i++)UpdateFirework(i);}void DrawFireworks() {HBRUSH hBrush;for (int i = 0; i < MAX_FIREWORKS; i++) {if (!fireworks[i].exploded) {hBrush = CreateSolidBrush(fireworks[i].color);SelectObject(hDCMem, hBrush);Ellipse(hDCMem, fireworks[i].x - 5,fireworks[i].y - 5, fireworks[i].x + 5, fireworks[i].y + 5);DeleteObject(hBrush);}else {for (int j = 0; j < MAX_PARTICLES; j++) {hBrush = CreateSolidBrush(RGB(255, 255, 255)/*fireworks[i].color*/);SelectObject(hDCMem, hBrush);SetPixel(hDCMem,fireworks[i].particles[j].x, fireworks[i].particles[j].y, fireworks[i].color*fireworks[i].particles[j].brightness);DeleteObject(hBrush);}}}}DWORD WINAPI UpdateThread(LPVOID lpParam) {while (true) {UpdateFireworks();Sleep(10);}return 0;}int main() {HWND hWnd = GetDesktopWindow();HDC hDC = GetDC(hWnd);screenHeight = GetSystemMetrics(SM_CYSCREEN);screenWidth = GetSystemMetrics(SM_CXSCREEN);hDCMem = CreateCompatibleDC(hDC);hBitmap = CreateCompatibleBitmap(hDC, screenWidth, screenHeight);hOldBitmap = (HBITMAP)SelectObject(hDCMem, hBitmap);InitializeFireworks();CreateThread(NULL, 0, &UpdateThread, NULL, 0, NULL);MSG msg;BOOL bRet;while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) { if (bRet == -1)break;else {TranslateMessage(&msg);DispatchMessage(&msg);DrawFireworks();BitBlt(hDC, 0, 0, screenWidth, screenHeight, hDCMem, 0, 0, SRCCOPY);}}SelectObject(hDCMem, hOldBitmap);DeleteObject(hBitmap);DeleteDC(hDCMem);ReleaseDC(hWnd, hDC);return 0;}```本程序实现了多个烟花同时在屏幕上绽放和消失,其中每个烟花的颜色和位置随机生成。

python代码实现烟花代码

python代码实现烟花代码

烟花代码是一种在编程界很受欢迎的代码实现,其通过使用Python 编程语言,结合图形库,实现了在屏幕上绚丽多彩的烟花效果。

本文将通过以下几个部分来介绍如何使用Python实现烟花代码。

一、概述烟花代码的实现是基于Python编程语言的图形库,通过利用库中的绘图函数和动画函数,可以实现烟花在屏幕上绽放的效果。

在这个过程中,我们需要灵活运用Python语言的各项功能和特点,深入理解绘图逻辑和动画原理,才能编写出高质量、流畅易读、结构合理的烟花代码。

二、环境准备在编写烟花代码之前,首先需要搭建Python编程环境。

我们可以选择在本地安装Python解释器和相应的第三方图形库,也可以选择上线的Python编程环境。

无论哪种方式,都需要确保Python环境的稳定运行,并且可以正常使用绘图函数和动画函数。

三、代码实现接下来我们将开始编写烟花代码。

我们需要导入相关的库和模块,包括图形库和数学库。

我们定义一个烟花类,该类包含了烟花的属性和行为,如位置、颜色、运动轨迹等。

我们编写绘制烟花的函数和更新烟花位置的函数,通过不断调用这些函数,就可以实现烟花在屏幕上绽放的效果。

四、代码调试在编写完烟花代码后,我们需要进行代码调试,确保代码的正确性和稳定性。

通过逐步运行代码,观察烟花的绘制过程和动画效果,检查是否有错误和bug。

如果发现问题,及时优化和修改代码,直至代码可以正常运行。

五、代码优化除了保证代码的正确性和稳定性,我们还可以对烟花代码进行优化。

可以优化烟花的绘制过程和动画效果,增加烟花的多样性和美观性。

可以考虑优化代码的性能和效率,减少运行时的资源消耗和时间消耗,让烟花代码更加流畅和轻巧。

六、总结通过以上的步骤,我们可以实现高质量、流畅易读、结构合理的烟花代码。

通过灵活运用Python编程语言的各项功能和特点,深入理解绘图逻辑和动画原理,不断调试和优化代码,就可以实现在屏幕上绚丽多彩的烟花效果。

希望本文对大家编写烟花代码有所帮助,也希望大家可以继续深入研究和应用Python编程语言,实现更多有趣和精彩的项目。

Python烟花秀源码

Python烟花秀源码

Python烟花秀源码Python跨年烟花表演烟花的粒子类class particle: #烟花的粒子类def__init__(self,canvas,num,sums,x,y,x_speed,y_speed,explosion_speed,color,size,max _life):self.canvas=canvas #画布self.num=num #粒子的序号self.sums=sums #粒子的个数self.x=x #粒子的横向坐标self.y=y #粒子的纵向坐标self.x_speed=x_speed #粒子在横向的移动速度self.y_speed=y_speed #粒子在纵向的移动速度self.initial_speed=explosion_speed #粒子的初始速度self.color=color #粒子的颜色self.life=0 #粒子当前存活的时间self.max_life=max_life #粒子最大的存活时间self.oval=self.canvas.create_oval(x-size,y-size,x+size,y+size,fill=self.color) #粒子的范围(烟花的大小)def expand(self): #判断粒子是否还在爆炸if self.life<=1.5: #粒子是否到达最大爆炸时间return 1else:return 0def alive(self): #判断粒子是否存活if self.life<=self.max_life: #粒子是否到达最大存活时间return 1else:return 0def new(self,dt): #更新当前烟花的粒子位置self.life=self.life+dt #更新当前存活时间if self.alive() and self.expand(): #如果当前存活时间在爆炸时间内move_x=m.cos(m.radians(self.num*360/self.sums))*self.initial_speed #则执行爆炸,更新横向坐标move_y=m.sin(m.radians(self.num*360/self.sums))*self.initial_speed #更新纵向坐标self.canvas.move(self.oval,move_x,move_y) #在画布上更新烟花self.x_speed=move_x/(float(dt)*1000) #烟花绽放的速度elif self.alive(): #如果爆炸结束了,但粒子还存在,则开始坠落move_x=m.cos(m.radians(self.num*360/self.sums)) #更新横向坐标self.canvas.move(self.oval,self.x_speed+move_x,self.y_speed+0.05*dt) #在画布上更新烟花self.y_speed=self.y_speed+0.5*dt #烟花坠落的速度elif self.oval is not None: #如果在坠落的时间外了,就将烟花从画布上擦除 canvas.delete(self.oval)self.oval=None烟花秀的实现def fireworks(canvas):#烟花函数(循环更新当前界面)times=ti.time() #获取当前时间戳explode_points=[] #烟花列表wait_time=r.randint(1,10) #等待时间num_explode=r.randint(20,30) #烟花的个数for point in range(num_explode): #依次更新各个烟花firework=[] #当前烟花的粒子列表x=r.randint(50,550) #当前烟花的粒子在横向的活动范围y=r.randint(50,150) #当前烟花的粒子在纵向的活动范围speed=r.uniform(0.5,2) #粒子的绽放速度size=r.uniform(0.5,1.5) #粒子的大小color=r.choice(colors) #粒子的颜色explosion_speed=r.uniform(0.2,5) #粒子爆炸的速度sum_particles=r.randint(30,50) #粒子的总数max_life=r.uniform(0.6,1.75) #粒子的最大存活时间for i in range(1,sum_particles): #当前烟花的每个粒子的参数fire=particle(canvas,num=i,sums=sum_particles,explosion_speed=explosion_speed,x =x,y=y,x_speed=speed,y_speed=speed,color=color,size=size,max_life=max_life) firework.append(fire) #将当前粒子加入到当前的烟花粒子列表中explode_points.append(firework) #将当前烟花加入到烟花列表中expand_time=0 #初始爆炸的时间while expand_time<2: #如果爆炸的时间小于2ti.sleep(0.001) #爆炸帧newtime=ti.time() #获取爆炸一次的时间戳times,dt=newtime,newtime-times #更新当前的时间戳for point in explode_points: #更新所有的粒子位置for item in point:item.new(dt)canvas.update() #更新当前画布expand_time=expand_time+dt #更新当前的爆炸时间 global root #root界面是全局变量root.after(wait_time,fireworks,canvas)。

c语言烟花程序代码 -回复

c语言烟花程序代码 -回复

c语言烟花程序代码-回复下面是一个简单的C 语言烟花程序代码:cinclude <stdio.h>include <stdlib.h>include <time.h>include <Windows.h>void delay(int milliseconds) {long pause;clock_t now, then;pause = milliseconds * (CLOCKS_PER_SEC / 1000);now = then = clock();while ((now - then) < pause) {now = clock();}}void setCursorPos(int x, int y) {COORD pos = {x, y};HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(output, pos);}void setColor(int color) {HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleTextAttribute(output, color);}int main() {srand(time(NULL));int width = 50;int height = 20;int x = width / 2;int y = height - 2;while (1) {int r = rand() 256;int g = rand() 256;int b = rand() 256;int color = r + g * 256 + b * 256 * 256;int speed = 1 + rand() 5;int angle = 30 + rand() 121;int rads = angle * 3.14159 / 180;float vx = speed * cos(rads);float vy = -speed * sin(rads);setCursorPos(x, y);setColor(color);printf(".");delay(100);setCursorPos(x, y);printf(" ");x += vx;y += vy;vx *= 0.99;vy += 0.08;if (y >= height) {break;}}setColor(15);setCursorPos(0, height);printf("烟花绽放完毕!\n");return 0;}第一步:了解代码功能这段代码实现了一个简单的烟花绽放效果。

汇编语言实现烟花效果

汇编语言实现烟花效果

汇编语言实现烟花效果; Fireworks - with MMX blur and light effects; by ronybc from Kerala,INDIA; website: /doc/964822920.html,.686p.MMX.model flat,stdcalloption casemap:noneinclude \masm32\include\windows.incinclude \masm32\include\kernel32.incinclude \masm32\include\gdi32.incinclude \masm32\include\user32.incincludelib \masm32\lib\kernel32.libincludelib \masm32\lib\gdi32.libincludelib \masm32\lib\user32.lib; struct spark {float x,xv,y,yv;};; struct FireShell {DWORD life; float air; spark d[250];}; ; sizeof FireShell = 250*4*4+8 = 4008 bytesEXX EQU 4EXY EQU 8AIR EQU 12SPARC EQU 16.dataClassName db "apocalypse",0AppName db "Fireworks MMX ...by ronybc",0,0,0,0,0,0info db "Fireworks Version: 3.40229 - Freeware",13,10db 13,10db "WARNING: This is a Fireware, softwares that push CPU temperature",13,10db "to its maximum. It does No harm, but overclockers better stay away :)",13,10db "Entire source code of this program is free available at my website. ",13,10db 13,10db "If you like the work, help the author with donations.",13,10db "see /doc/964822920.html,/support.htm",13,10 db 13,10db "SPACE & ENTER keys toggles 'Gravity and Air' and",13,10 db "'Light and Smoke' effects respectively.",13,10db "And clicks explode..! close clicks produce more light",13,10db 13,10db "Manufactured, bottled and distributed by",13,10db "Silicon Fumes Digital Distilleries, Kerala, INDIA",13,10db 13,10db "Copyright 1999-2004 ?Rony B Chandran. All Rights Reserved",13,10db 13,10db "This isn't the Final Version",13,10db "check /doc/964822920.html, for updates and more",0seed dd 2037280626wwidth dd 680 ; 1:1.618, The ratio of beauty ;)wheight dd 420 ; smaller the window faster the firesmaxx dd 123 ; 123: values set on executionmaxy dd 123 ; this thing is best for comparinglightx dd 123 ; cpu performance.lighty dd 123flash dd 123flfactor dd 0.92adg dd 0.00024 ; 0.00096 acceleration due to gravityxcut dd 0.00064nb dd 5 ; number of shellsnd dd 400 ; sparks per shellsb dd 0 ; value set on executionmaxpower dd 5minlife dd 500 ; altered @WndProc:WM_COMMAND:1300motionQ dd 16 ; 01-25, altered @WndProc:WM_COMMAND:1210fcount dd 0GMode dd 1 ; atmosphere or outer-spaceCMode dd 0 ; color shifterEMode dd 1 ; special effectsclick dd 0stop dd 0fadelvl dd 1chemtable dd 00e0a0ffh, 00f08030h, 00e6c080h, 0040b070h, 00aad580hbminf BITMAPINFO <<40,0,0,1,24,0,0,0,0,0,0>>.data?hInstance HINSTANCE ?hwnd LPVOID ?hmnu HWND ?wnddc HDC ?hFThread HANDLE ?hHeap HANDLE ?idThread1 DWORD ?idThread2 DWORD ?bitmap1 LPVOID ?bitmap2 LPVOID ?hFShells LPVOID ?msg MSG <>wc WNDCLASSEX <>.coderandom PROC base:DWORD ; Park Miller random number algorithmmov eax, seed ; from M32lib/nrand.asmxor edx, edxmov ecx, 127773div ecxmov ecx, eaxmov eax, 16807mul edxmov edx, ecxmov ecx, eaxmov eax, 2836mul edxsub ecx, eaxxor edx, edxmov eax, ecxmov seed, ecxdiv basemov eax, edxretrandom ENDP; -------------------------------------------------------------------------Light_Flash3 PROC x1:DWORD, y1:DWORD, lum:DWORD, src:DWORD, des:DWORDLOCAL mx:DWORD, my:DWORD, x2:DWORD, y2:DWORD, tff:DWORDmov eax,lumshr eax,1 ; Light_Flash: dynamic 2D lighting routinemov lum,eax ; does not uses any pre-computed datamov tff,255 ; ie. pure light frum tha melting cpu core :)mov eax,maxxmov mx,eaxmov eax,maxydec eaxmov my,eaxmov esi,srcmov edi,desxor eax,eaxmov y2,eaxylp3: ; 2x2 instead of per pixel lightingxor eax,eax ; half the quality, but higher speedmov x2,eaxxlp3:mov eax,y2sub eax,y1imul eaxmov ebx,x2sub ebx,x1imul ebx,ebxadd eax,ebxmov edx,lumimul edx,edxxor ebx,ebxcmp eax,edxja @F ; jump to end causes time waves push eaxfild dword ptr[esp]fsqrtfidiv lum ; this code is -nonlinear-fld1fsubrp st(1),st(0)fmul st(0),st(0) ; curvefmul st(0),st(0) ; curve morefimul tfffistp dword ptr[esp]pop ebximul ebx,01010101h@@:mov eax,y2imul maxxadd eax,x2lea eax,[eax+eax*2]mov edx,maxxlea edx,[edx+edx*2]add edx,eaxmovd MM2,ebx ; simply add with saturationmovq MM0,[esi+eax] ; gamma correction is against this code psllq MM2,32movq MM1,[esi+edx]movd MM3,ebxpor MM2,MM3paddusb MM0,MM2movd [edi+eax],MM0paddusb MM1,MM2psrlq MM0,32movd [edi+edx],MM1movd ebx,MM0psrlq MM1,32mov [edi+eax+4],bxmovd ecx,MM1mov [edi+edx+4],cxemms@@:mov eax,x2add eax,2mov x2,eaxcmp eax,mxjbe xlp3mov eax,y2add eax,2mov y2,eaxcmp eax,myjbe ylp3retLight_Flash3 ENDP; -------------------------------------------------------------------------Blur_MMX2 PROC ; 24bit color versionmov edi,bitmap2 ; (Developed under an old SiS6326 graphic cardmov esi,bitmap1 ; which prefers 24bit for faster operation)mov bitmap1,edi ; Note: SiS315 is excellent, good rendering qualitymov bitmap2,esipxor MM7,MM7mov eax,fadelvlimul eax,00010001hmov [ebp-4],eaxmov [ebp-8],eaxmovq MM6,[ebp-8]mov eax,maxxlea eax,[eax+eax*2]mov ebx,eaximul maxypush eax ; maxy*maxx*3lea edx,[ebx-3]lea ebx,[ebx+3]neg edxxor eax,eaxlea esi,[esi-3]@@:movd MM0,[esi] ; code enlarged version punpcklbw MM0,MM7 ; optimized for speed, not size movd MM1,[esi+8]movd MM2,[esi+16]punpcklbw MM1,MM7punpcklbw MM2,MM7movd MM3,[esi+6]movd MM4,[esi+14]movd MM5,[esi+22]punpcklbw MM3,MM7paddw MM0,MM3punpcklbw MM4,MM7paddw MM1,MM4punpcklbw MM5,MM7paddw MM2,MM5movd MM3,[esi+ebx]punpcklbw MM3,MM7paddw MM0,MM3movd MM4,[esi+ebx+8]movd MM5,[esi+ebx+16]punpcklbw MM4,MM7paddw MM1,MM4punpcklbw MM5,MM7paddw MM2,MM5movd MM3,[esi+edx]punpcklbw MM3,MM7paddw MM0,MM3movd MM4,[esi+edx+8]movd MM5,[esi+edx+16]punpcklbw MM4,MM7paddw MM1,MM4punpcklbw MM5,MM7paddw MM2,MM5psrlw MM0,2 ; neibours only, ie. smoky blurpsrlw MM1,2psrlw MM2,2psubusw MM0,MM6 ; fadepsubusw MM1,MM6psubusw MM2,MM6packuswb MM0,MM7lea esi,[esi+12]packuswb MM1,MM7packuswb MM2,MM7movd [edi+eax],MM0movd [edi+eax+8],MM1movd [edi+eax+16],MM2lea eax,[eax+12]cmp eax,[esp]jbe @Bpop eaxemms ; free fpu registers for followingret ; floating-point functionsBlur_MMX2 ENDP; -------------------------------------------------------------------------FShell_explodeOS PROC hb:DWORDmov edi,hbadd edi,SPARCmov eax,nddec eaxshl eax,4@@:fld dword ptr[edi+eax] ; x coordinatefadd dword ptr[edi+eax+4] ; x velocityfstp dword ptr[edi+eax]fld dword ptr[edi+eax+8] ; y coordinatefadd dword ptr[edi+eax+12] ; y velocityfstp dword ptr[edi+eax+8]sub eax,16jnc @Bdec dword ptr[edi-SPARC]mov eax,[edi-SPARC] ; return(--life)retFShell_explodeOS ENDP; -------------------------------------------------------------------------FShell_explodeAG PROC hb:DWORDmov edi,hbfld adg ; acceleration due to gravityfld dword ptr[edi+AIR] ; air resistanceadd edi,SPARCmov eax,nddec eaxshl eax,4@@:fld dword ptr[edi+eax+4] ; x velocityfmul st(0),st(1) ; deceleration by airfst dword ptr[edi+eax+4]fadd dword ptr[edi+eax] ; x coordinatefstp dword ptr[edi+eax]fld dword ptr[edi+eax+12] ; y velocityfmul st(0),st(1) ; deceleration by airfadd st(0),st(2) ; gravityfst dword ptr[edi+eax+12]fadd dword ptr[edi+eax+8] ; y coordinatefstp dword ptr[edi+eax+8]sub eax,16jnc @Bfcompp ; marks st(0) and st(1) emptydec dword ptr[edi-SPARC]mov eax,[edi-SPARC] ; return(--life)retFShell_explodeAG ENDP; -------------------------------------------------------------------------FShell_render PROC hb:DWORD, color:DWORDLOCAL expx:DWORD, expy:DWORDmov edi,hbmov eax,[edi+EXX]mov expx,eaxmov eax,[edi+EXY]mov expy,eaxadd edi,SPARCmov ebx,colordec ebx;and ebx,3mov ecx,offset chemtablemov edx,hFShells ; floats are beautiful, and cheap source of add edx,32 ; the chemical used for multi colored fires mov eax,CModeor eax,eaxcmovz edx,ecxmov edx,[edx+ebx*4]mov ecx,nddec ecxshl ecx,4mov esi,bitmap1push maxy ; using stack adds speedpush maxx ; (local variables)push edx@@:fld dword ptr[edi+ecx+4]fabsfld xcut ; low cost code for independant burnoutsfcomip st(0),st(1)fistp dword ptr[esp-4]jae forgetfld dword ptr[edi+ecx]fistp dword ptr[esp-4]fld dword ptr[edi+ecx+8]fistp dword ptr[esp-8]mov eax,[esp-8]cmp eax,[esp+8]jae forgetmov ebx,[esp-4]cmp ebx,[esp+4]jae forgetimul dword ptr[esp+4]add eax,ebxlea eax,[eax+eax*2]mov edx,[esp]mov [esi+eax],dxshr edx,16mov [esi+eax+2],dlforget:sub ecx,16jnc @B;add esp,12 'leave'ing (ENDP)retFShell_render ENDP; -------------------------------------------------------------------------FShell_recycle PROC hb:DWORD, x:DWORD, y:DWORDmov edi,hbmov eax,xmov [edi+EXX],eaxmov eax,ymov [edi+EXY],eaxmov eax,xmov lightx,eax ; Light last onemov eax,ymov lighty,eaxmov eax,flash ; having only one light sourceadd eax,3200 ; 3200 million jouls...!mov flash,eax ; add if previous lighting not extinguishedinvoke random,20inc eaximul minlifemov ebx,eax ; sync explosions by mouse clicks with restmov eax,[edi] ; by maintaining minimum delay of 'minlife'xor edx,edxidiv minlifeadd edx,ebxmov [edi],edxinvoke random,30 ; like its real world counterpart, creation processadd eax,10 ; is long and boring but the end product is explodin..mov [esp-4],eax ; refer C++ source also. Most of the below areamov eax,10000 ; is blind translation of that original C code mov [esp-8],eax ; i crawled on that code as a Human C compiler...!fld1fild dword ptr[esp-4]fidiv dword ptr[esp-8]fsubp st(1),st(0)fstp dword ptr[edi+AIR]add edi,SPARCfild yfild xmov eax,1000mov [esp-4],eaxfild dword ptr[esp-4] ; 1000 (constant) invoke random,maxpowerinc eaxmov [esp-4],eaxfild dword ptr[esp-4] ; powermov ecx,nddec ecxshl ecx,4@@:push ecxinvoke random,2000mov [esp-4],eaxfild dword ptr[esp-4]fsub st(0),st(2)fdiv st(0),st(2)fmul st(0),st(1)mov ecx,[esp]fstp dword ptr[edi+ecx+4]fld st(0)fmul st(0),st(0)fld dword ptr[edi+ecx+4]fmul st(0),st(0)fsubp st(1),st(0)fsqrtinvoke random,2000mov [esp-4],eaxfild dword ptr[esp-4]fsub st(0),st(3)fdiv st(0),st(3)fmulp st(1),st(0)mov ecx,[esp]fstp dword ptr[edi+ecx+12]fld st(2)fstp dword ptr[edi+ecx]fld st(3)fstp dword ptr[edi+ecx+8]pop ecxsub ecx,16jnc @BfcomppfcomppretFShell_recycle ENDP; -------------------------------------------------------------------------FireThread:invokeSetThreadPriority,idThread1,THREAD_PRIORITY_HIGHEST invoke GetDC,hwndmov wnddc,eaxinvoke GetProcessHeapmov hHeap,eaxinvoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,4194304add eax,4096 ; blur: -1'th line problemmov bitmap1,eaxinvoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,4194304add eax,4096 ; blur: -1'th line problemmov bitmap2,eaxmov eax,ndshl eax,4add eax,SPARCmov sb,eax ; size of FShell = nd*16+8imul nb ; array size = nb*sbinvoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,eax mov hFShells,eaxfinit ; initialise floating point unitmov ax,07fh ; low precision floatsmov word ptr[esp-4],ax ; fireworks... not space rockets fldcw word ptr[esp-4]sub ebp,12 ; as 3 local variablesmov eax,nbmov [ebp],eaxmov eax,hFShellsmov [ebp+4],eaxinitshells:;mov eax,maxx ; naah... not needed;shr eax,1 ; trusting auto-zero;invoke FShell_recycle,[ebp+4],eax,maxy;mov eax,sb;add [ebp+4],eax;dec dword ptr[ebp];jnz initFShells;mov flash,6400lp1:mov eax,motionQmov dword ptr[ebp+8],eaxlp2:mov eax,nbmov [ebp],eaxmov eax,hFShellsmov [ebp+4],eaxlp3:invoke FShell_render,[ebp+4],[ebp] mov eax,GModemov ecx,offset FShell_explodeAG mov ebx,offset FShell_explodeOS test eax,eaxcmovz ecx,ebxpush [ebp+4]call ecxtest eax,eaxjns @Finvoke random,maxypush eaxmov eax,maxxadd eax,eaxinvokerandom,eaxmov edx,maxxshr edx,1sub eax,edxpush eaxpush [ebp+4]call FShell_recycle@@:mov eax,sbadd [ebp+4],eaxdec dword ptr[ebp]jnz lp3dec dword ptr[ebp+8]jnz lp2mov eax,EModetest eax,eaxjz r1mov eax,CMode ; switch pre/post blur according to - test eax,eax ; current chemical in firejz @Finvoke Blur_MMX2@@:invoke Light_Flash3,lightx,lighty,flash,bitmap1,bitmap2 invoke SetDIBitsToDevice,wnddc,0,0,maxx,maxy,\0,0,0,maxy,bitmap2,ADDR bminf,DIB_RGB_COLORS mov eax,CModetest eax,eaxjnz r2invoke Blur_MMX2jmp r2r1:invoke SetDIBitsToDevice,wnddc,0,0,maxx,maxy,\0,0,0,maxy,bitmap1,ADDR bminf,DIB_RGB_COLORS mov eax,maxximul maxylea eax,[eax+eax*2]invoke RtlZeroMemory,bitmap1,eaxr2:inc fcount ; count the framesfild flashfmul flfactorfistp flashinvoke Sleep,5 ; control, if frames rate goes too highmov eax,stoptest eax,eaxjz lp1invoke ReleaseDC,hwnd,wnddcinvoke HeapFree,hHeap,0,bitmap1invoke HeapFree,hHeap,0,bitmap2invoke HeapFree,hHeap,0,hFShellsmov idThread1,-1invoke ExitThread,2003hlt ; ...! i8085 memories; -------------------------------------------------------------------------.datafps db 64 dup (0)fmat db "fps = %u [/doc/964822920.html,]",0.codeMoniThread:invoke Sleep,1000invoke wsprintf,ADDR fps,ADDR fmat,fcountinvoke SetWindowText,hwnd,ADDR fpsxor eax,eaxmov fcount,eaxmov eax,stoptest eax,eaxjz MoniThreadmov idThread2,-1invoke ExitThread,2003; -------------------------------------------------------------------------Switch PROC oMode:DWORD, iid:DWORDxor eax,eaxmov edx,oModeor al,byte ptr [edx]setz byte ptr [edx]mov eax,[edx]mov ebx,MF_CHECKEDshl eax,3and eax,ebxor eax,MF_BYCOMMANDinvoke CheckMenuItem,hmnu,iid,eaxretSwitch ENDP; -------------------------------------------------------------------------WndProc PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM.IF uMsg==WM_MOUSEMOVE && wParam==MK_CONTROLxor edx,edxmov flash,2400mov eax,lParammov dx,axshr eax,16mov lightx,edxmov lighty,eax.ELSEIF uMsg==WM_SIZE && wParam!=SIZE_MINIMIZEDxor edx,edxmov eax,lParammov dx,axshr eax,16shr edx,2shl edx,2mov maxx,edxmov maxy,eaxmov bminf.bmiHeader.biWidth,edxneg eax ; -maxymov bminf.bmiHeader.biHeight,eax.ELSEIF uMsg==WM_KEYDOWN && wParam==VK_SPACE invoke Switch,OFFSET GMode,1200.ELSEIF uMsg==WM_KEYDOWN && wParam==VK_RETURNinvoke Switch,OFFSET EMode,1220mov flash,0.ELSEIF uMsg==WM_RBUTTONDOWNinvoke MessageBox,hWnd,ADDR info,ADDR AppName,MB_OK or MB_ICONASTERISK.ELSEIF uMsg==WM_LBUTTONDOWNxor edx,edxmov eax,lParammov dx,axshr eax,16push eaxpush edxmov edx,nbdec edxmov eax,clickdec eaxcmovs eax,edxmov click,eaximul sbadd eax,hFShellspush eaxcall FShell_recycle.ELSEIF uMsg==WM_CLOSEmov stop,1 ; stop running threadsinvoke Sleep,100 ; avoid FireThread drawing without window invoke DestroyWindow,hwndinvoke PostQuitMessage,0.ELSEIF uMsg==WM_COMMAND.IF wParam==1010invoke SendMessage,hwnd,WM_CLOSE,0,0.ELSEIF wParam==1000invoke SuspendThread,hFThread ; suffering technical difiiculties :)mov eax,maxx ; major motiv - to see ZeroMem in acionimul maxylea eax,[eax+eax*2]invoke RtlZeroMemory,bitmap1,eax ; this thing is fast,invoke RtlZeroMemory,bitmap2,eax ; but hidden from some API docspush nbpush hFShells@@:mov eax,maxx;shr eax,1shr eax,2mov edx,[esp+4]dec edximul eax,edxmov ebx,maxyshr ebx,1invoke FShell_recycle,[esp+8],eax,ebxmov eax,sbadd [esp],eaxdec dword ptr[esp+4]jnz @B;mov flash,6400invoke ResumeThread,hFThreadpop eaxpop eax.ELSEIF wParam==1200invoke Switch,OFFSET GMode,1200.ELSEIF wParam==1210invoke Switch,OFFSET CMode,1210mov ecx,CModemov eax,16shr eax,clmov motionQ,eax ; changing motionQ affects speed.ELSEIF wParam==1220invoke Switch,OFFSET EMode,1220mov flash,0.ELSEIF wParam==1300invoke CheckMenuItem,hmnu,1310,MF_BYCOMMAND orMF_UNCHECKEDinvoke CheckMenuItem,hmnu,1300,MF_BYCOMMAND or MF_CHECKEDmov minlife,500 ; long interval between shoots.ELSEIF wParam==1310invoke CheckMenuItem,hmnu,1300,MF_BYCOMMAND or MF_UNCHECKEDinvoke CheckMenuItem,hmnu,1310,MF_BYCOMMAND or MF_CHECKEDmov minlife,100 ; short interval.ELSEIF wParam==1400invoke MessageBox,hWnd,ADDR info,ADDR AppName,MB_OK or MB_ICONASTERISK.ENDIF.ELSEinvoke DefWindowProc,hWnd,uMsg,wParam,lParamret.ENDIFxor eax,eaxretWndProc ENDP; -------------------------------------------------------------------------start:invoke GetModuleHandle,NULLmov hInstance,eaxmov wc.hInstance,eaxmov wc.cbSize,SIZEOF WNDCLASSEXmov wc.style,CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNCLIENTmov wc.lpfnWndProc,OFFSET WndProcmov wc.cbClsExtra,NULLmov wc.cbWndExtra,NULLmov wc.hbrBackground,COLOR_MENUTEXTmov wc.lpszMenuName,NULLmov wc.lpszClassName,OFFSET ClassNameinvoke LoadCursor,NULL,IDC_ARROWmov wc.hCursor,eaxinvoke LoadIcon,hInstance,500mov wc.hIcon,eaxmov wc.hIconSm,eaxinvoke RegisterClassEx,ADDR wcinvokeCreateWindowEx,WS_EX_OVERLAPPEDWINDOW,ADDR ClassName,ADDR AppName,\WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\CW_USEDEFAULT,wwidth,wheight,NULL,NULL,\hInstance,NULLmov hwnd,eaxadd seed,eax ;)invoke LoadMenu,hInstance,600mov hmnu,eaxinvoke SetMenu,hwnd,eaxinvoke CheckMenuItem,hmnu,1200,MF_BYCOMMAND or MF_CHECKEDinvoke CheckMenuItem,hmnu,1220,MF_BYCOMMAND or MF_CHECKEDinvoke CheckMenuItem,hmnu,1300,MF_BYCOMMAND or MF_CHECKEDinvoke ShowWindow,hwnd,SW_SHOWNORMALinvoke UpdateWindow,hwndinvoke CreateThread,0,4096,ADDR MoniThread,0,0,ADDR idThread1invoke CreateThread,0,4096,ADDR FireThread,0,0,ADDR idThread2mov hFThread,eaxMsgLoop:invoke GetMessage,ADDR msg,0,0,0test eax,eaxjz EndLoopinvoke TranslateMessage,ADDR msginvoke DispatchMessage,ADDR msgjmp MsgLoopEndLoop:@@: mov eax,idThread1or eax,idThread2not eaxand eax,eaxjnz @Binvoke ExitProcess,eaxend start。

r语言烟花代码编程

r语言烟花代码编程

在R语言中,创建一个简单的烟花效果可能需要使用图形库,如ggplot2,plotly,或者animation。

然而,这些库主要用于静态或动态的数据可视化,而不是创建像烟花这样的动画效果。

为了创建烟花效果,你可能需要使用更专门的动画或图形库,如rgl(用于3D图形)或者gganimate(基于ggplot2的动画)。

然而,这些库可能也无法直接创建出传统的烟花效果。

如果你真的想在R中创建烟花效果,你可能需要寻找一个专门的R包,或者可能需要使用其他编程语言(如Python的matplotlib库,或者JavaScript的p5.js库)来创建这种效果。

然而,这里有一个使用rgl库在R中创建类似烟花效果的简单示例。

请注意,这只是一个非常基础的示例,并不能完全模拟出真实的烟花效果。

R复制代码library(rgl)# 设置随机种子以便结果可复现set.seed(123)# 创建一些随机的3D点n <- 1000x <- runif(n, -1, 1)y <- runif(n, -1, 1)z <- runif(n, -1, 1)# 创建3D散点图plot3d(x, y, z, col = "white", size = 2)# 为每个点添加一些随机的"爆炸"效果for (i in1:n) {x_new <- x[i] + rnorm(100, 0, 0.1)y_new <- y[i] + rnorm(100, 0, 0.1)z_new <- z[i] + rnorm(100, 0, 0.1)points3d(x_new, y_new, z_new, col = "white", size = 0.5)}# 显示3D图形rgl.snapshot("fireworks.png")这段代码会创建一个3D散点图,并在每个点上添加一些随机的"爆炸"效果,这有点像烟花的爆炸效果。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
mov mx,eax
mov eax,maxy
dec eax
mov my,eax
mov esi,src
mov edi,des
xor eax,eax
mov y2,eax
ylp3: ; 2x2 instead of per pixel lighting
bminf BITMAPINFO <<40,0,0,1,24,0,0,0,0,0,0>>
.data?
hInstance HINSTANCE ?
hwnd LPVOID ?
hmnu HWND ?
wnddc HDC ?
hFThread HANDLE ?
info db "Fireworks Version: 3.40229 - Freeware",13,10
db 13,10
db "WARNING: This is a Fireware, softwares that push CPU temperature",13,10
maxy dd 123 ; this thing is best for comparing
lightx dd 123 ; cpu performance.
lighty dd 123
flash dd 123
push eax
fild dword ptr[esp]
fsqrt
fidiv lum ; this code is -nonlinear-
fld1
fsubrp st(1),st(0)
fmul st(0),st(0) ; curve
Light_Flash3 PROC x1:DWORD, y1:DWORD, lum:DWORD, src:DWORD, des:DWORD
LOCAL mx:DWORD, my:DWORD, x2:DWORD, y2:DWORD, tff:DWORD
mov eax,lum
shr eax,1 ; Light_Flash: dynamic 2D lighting routine
db 13,10
db "If you like the work, help the author with donations.",13,10
db "see /support.htm",13,10
div ecx
mov ecx, eax
mov eax, 16807
mul edx
mov edx, ecx
mov ecx, eax
mov eax, 2836
mul edx
sub ecx, eax
xor edx, edx
db "And clicks explode..! close clicks produce more light",13,10
db 13,10
db "Manufactured, bottled and distributed by",13,10
imul ebx,ebx
add eax,ebx
mov edx,lum
imul edx,edx
xor ebx,ebx
cmp eax,edx
ja @F ; jump to end causes time waves
; Fireworks - with MMX blur and light effects
; by ronybc from Kerala,INDIA
; website:
.686p
.MMX
.model flat,stdcall
option casemap:none
db "to its maximum. It does No harm, but overclockers better stay away :)",13,10
db "Entire source code of this program is free available at my website. ",13,10
fmul st(0),st(0) ; curve more
fimul tff
fistp dword ptr[esp]
pop ebx
imul ebx,01010101h
@@:
mov eax,y2
imul maxx
.code
random PROC base:DWORD ; Park Miller random number algorithm
mov eax, seed ; from M32lib/nrand.asm
xor edx, edx
mov ecx, 127773
db 13,10
db "SPACE & ENTER keys toggles 'Gravity and Air' and",13,10
db "'Light and Smoke' effects respectively.",13,10
wwidth dd 680 ; 1:1.618, The ratio of beauty ;)
wheight dd 420 ; smaller the window faster the fires
maxx dd 123 ; 123: values set on execution
db 13,10
db "This isn't the Final Version",13,10
db "check for updates and more",0
seed dd 2037280626
hHeap HANDLE ?
idThread1 DWORD ?
idThread2 DWORD ?
bitmap1 LPVOID ?
bitmap2 LPVOID ?
hFShells LPVOID ?
msg MSG <>
wc WNDCLASSEX <>
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
; struct spark {float x,xv,y,yv;};
; struct FireShell {DWORD life; float air; spark d[250];};
xor eax,eax ; half the quality, but higher speed
mov x2,eax
xlp3:
mov eax,y2
sub eax,y1
imul eax
mov ebx,x2
sub ebx,x1
nd dd 400 ; sparks per shell
sb dd 0 ; value set on execution
maxpower dd 5
minlife dd 500 ; altered @WndProc:WM_COMMAND:1300
mov lum,eax ; does not uses any pre-computed data
mov tff,255 ; ie. pure light frum tha melting cpu core :)
mov eax,maxx
add eax,x2
lea eax,[eax+eax*2]
mov edx,maxx
lea edx,[edx+edx*2]
add edx,eax
movd MM2,ebx ; simply add with saturation
EMode dd 1 ; special effects
click dd 0
stop dd 0
fadelvl dd 1
chemtable dd 00e0a0ffh, 00f08030h, 00e6c080h, 0040b070h, 00aad580h
flfactor dd 0.92
adg dd 0.00024 ; 0.00096 acceleration due to gravity
xcut dd 0.00064
nb dd 5 ; number of shells
motionQ dd 16 ; 01-25, altered @WndProc:WM_COMMAND:1210
fcount dd 0
GMode dd 1 ; atmosphere or outer-space
CMode dd 0 ; color shifter
mov eax, ecx
mov seed, ecx
div base
mov eax, edx
ret
random ENDP
; -------------------------------------------------------------------------
db "Silicon Fumes Digital Distilleries, Kerala, INDIA",13,10
db 13,10
db "Copyright 1999-2004 ?Rony B Chandran. All Rights Reserved",13,10
include \masm32\include\windows.inc
相关文档
最新文档