⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3dstarfield.txt

📁 屏保星空的编程。 使用VB编程。实现屏保功能呢。 有兴趣就下来
💻 TXT
字号:
I'm not that familiar with 3D programming , Z coordinates
and stuff so I kinda took the long way around.I have a 150 
element array of the data type STARS (with 4 properties X,
Y,ADDX,ADDY).  When it's initialized , all the elements have 
their X and Y coordinates set to reflect the center of the 
screen - Screen.Width/2 and Screen.Height/2 - and their AddX ,
 AddY properties are assigned a random number from -30 to 30.
In the main loop (I used a timer control with an interval of 
0.001 milliseconds but we all know that the fastest interval 
VB's built-in timer can handle is 0.18 sec :) the values 
of Star(i).X and Star(i).Y (where i is a counter that runs from 
1 to 150) are increased (or decreased ) by Star(i).AddX and 
Star(i).AddY . So each star can move towards any direction and 
with a random angle. That's the basic concept ,but it's not 
quite enough for a 3D looking starfield . Depending on how 
far from the center of the screen each star is - you can find 
that out with ABS(Screen.Width/2 - Star(i).X) and 
ABS(Screen.Height/2 - Star(i).Y) - it is painted with a different 
shade (stars that are far from the "camera" have darker shades 
of grey) and a different size . Actually there are 5 sizes of 
stars ,the ones that are size 1 are painted with 1 pixel, size 
2 stars with 2 pixels and so on. 


Theo Kandiliotis , ionikh@hol.gr
http://www.geocities.com/SiliconValley/Network/5045
Athens , Greece






⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -