Add project files
This commit is contained in:
parent
c02b178411
commit
3deab9da92
83
build.xml
Normal file
83
build.xml
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<project name="LetItSnow" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project .</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
pre-init: called before initialization of project properties
|
||||
post-init: called after initialization of project properties
|
||||
pre-preprocess: called before text preprocessing of sources
|
||||
post-preprocess: called after text preprocessing of sources
|
||||
pre-compile: called before source compilation
|
||||
post-compile: called after source compilation
|
||||
pre-obfuscate: called before obfuscation
|
||||
post-obfuscate: called after obfuscation
|
||||
pre-preverify: called before preverification
|
||||
post-preverify: called after preverification
|
||||
pre-jar: called before jar building
|
||||
post-jar: called after jar building
|
||||
pre-build: called before final distribution building
|
||||
post-build: called after final distribution building
|
||||
pre-clean: called before cleaning build products
|
||||
post-clean: called after cleaning build products
|
||||
|
||||
Example of pluging a my-special-task after the compilation could look like
|
||||
|
||||
<target name="post-compile">
|
||||
<my-special-task>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</my-special-task>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
Other way how to customize the build is by overriding existing main targets.
|
||||
The target of interest are:
|
||||
|
||||
preprocess: preprocessing
|
||||
extract-libs: extraction of libraries and resources
|
||||
compile: compilation
|
||||
create-jad: construction of jad and jar manifest source
|
||||
obfuscate: obfuscation
|
||||
preverify: preverification
|
||||
jar: jar archive building
|
||||
run: execution
|
||||
debug: execution in debug mode
|
||||
build: building of the final distribution
|
||||
javadoc: javadoc generation
|
||||
|
||||
Example of overriding the target for project execution could look like
|
||||
|
||||
<target name="run" depends="init,jar">
|
||||
<my-special-exec jadfile="${dist.dir}/${dist.jad}"/>
|
||||
</target>
|
||||
|
||||
Be careful about correct dependencies when overriding original target.
|
||||
Again, for list of available properties which you can use check the target
|
||||
you are overriding in nbproject/build-impl.xml file.
|
||||
|
||||
A special target for-all-configs can be used to run some specific targets for
|
||||
all project configurations in a sequence. File nbproject/build-impl.xml
|
||||
already contains some "for-all" targets:
|
||||
|
||||
jar-all
|
||||
javadoc-all
|
||||
clean-all
|
||||
|
||||
Example of definition of target iterating over all project configurations:
|
||||
|
||||
<target name="jar-all">
|
||||
<property name="target.to.call" value="jar"/>
|
||||
<antcall target="for-all-configs"/>
|
||||
</target>
|
||||
|
||||
-->
|
||||
</project>
|
1247
nbproject/build-impl.xml
Normal file
1247
nbproject/build-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
8
nbproject/genfiles.properties
Normal file
8
nbproject/genfiles.properties
Normal file
@ -0,0 +1,8 @@
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
build.xml.data.CRC32=d0d3406f
|
||||
build.xml.script.CRC32=3289d453
|
||||
build.xml.stylesheet.CRC32=9c6a911d
|
||||
nbproject/build-impl.xml.data.CRC32=d0d3406f
|
||||
nbproject/build-impl.xml.script.CRC32=4f6bb502
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=e46c2d22
|
7
nbproject/private/private.properties
Normal file
7
nbproject/private/private.properties
Normal file
@ -0,0 +1,7 @@
|
||||
#Fri, 06 Jan 2012 21:43:22 +0200
|
||||
app-version.autoincrement=true
|
||||
config.active=
|
||||
deployment.counter=41
|
||||
deployment.number=0.0.40
|
||||
javadoc.preview=true
|
||||
netbeans.user=C:\\Users\\aNNiMON\\.netbeans\\7.1
|
4
nbproject/private/private.xml
Normal file
4
nbproject/private/private.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
|
||||
</project-private>
|
142
nbproject/project.properties
Normal file
142
nbproject/project.properties
Normal file
@ -0,0 +1,142 @@
|
||||
abilities=MMAPI=1.1,SATSAJCRMI=1.0,SATSACRYPTO=1.0,JSR82=1.1,NOKIAUI=1.0,JSR226=1.0,capuchin=1.0,MIDP=2.1,JSR229=1.1.0,SATSAAPDU=1.0,CLDC=1.1,JSR177=1.0,JSR179=1.0.1,eSWT=1.1,J2MEWS=1.0,VSCL=2.1,WMA=2.0,JSR172=1.0,JSR256=1.1,SEMC_EXT_JP8=1.0,ColorScreen,NokiaUI=1.0,OBEX=1.0,JSR238=1.0,JSR239=1.0,JSR211=1.0,JSR234=1.0,ScreenWidth=240,MascotV3=1.0,JSR75=1.0,IAPInfo=1.0,SATSAPKI=1.0,JSR184=1.1,ScreenHeight=321,ScreenColorDepth=8,JSR180=1.0.1,J2MEXMLRPC=1.0,
|
||||
all.configurations=\
|
||||
application.args=
|
||||
application.description=
|
||||
application.description.detail=
|
||||
application.name=
|
||||
application.vendor=Vendor
|
||||
build.classes.dir=${build.dir}/compiled
|
||||
build.classes.excludes=**/*.java,**/*.form,**/*.class,**/.nbintdb,**/*.mvd,**/*.wsclient,**/*.vmd
|
||||
build.dir=build/${config.active}
|
||||
build.root.dir=build
|
||||
debug.level=debug
|
||||
debugger.timeout=
|
||||
deployment.copy.target=deploy
|
||||
deployment.instance=default
|
||||
deployment.jarurl=${dist.jar}
|
||||
deployment.method=NONE
|
||||
deployment.override.jarurl=false
|
||||
dist.dir=dist/${config.active}
|
||||
dist.jad=LetItSnow.jad
|
||||
dist.jar=LetItSnow.jar
|
||||
dist.javadoc.dir=${dist.dir}/doc
|
||||
dist.root.dir=dist
|
||||
extra.classpath=
|
||||
filter.exclude.tests=false
|
||||
filter.excludes=
|
||||
filter.more.excludes=**/overview.html,**/package.html
|
||||
filter.use.standard=true
|
||||
jar.compress=true
|
||||
javac.debug=true
|
||||
javac.deprecation=false
|
||||
javac.encoding=UTF-8
|
||||
javac.optimize=false
|
||||
javac.source=1.3
|
||||
javac.target=1.3
|
||||
javadoc.author=false
|
||||
javadoc.encoding=
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
libs.classpath=
|
||||
main.class=
|
||||
main.class.class=applet
|
||||
manifest.apipermissions=
|
||||
manifest.file=manifest.mf
|
||||
manifest.is.liblet=false
|
||||
manifest.jad=
|
||||
manifest.manifest=
|
||||
manifest.midlets=MIDlet-1: LetItSnow,/icon.png,Main\n
|
||||
manifest.others=MIDlet-Vendor: aNNiMON\nMIDlet-Name: LetItSnow\nMIDlet-Version: ${deployment.number}\n
|
||||
manifest.pushregistry=
|
||||
name=LetItSnow
|
||||
no.dependencies=false
|
||||
nokiaS80.application.icon=
|
||||
nsicom.application.monitorhost=
|
||||
nsicom.application.runremote=
|
||||
nsicom.application.runverbose=
|
||||
nsicom.remoteapp.location=\\My Documents\\NetBeans Applications
|
||||
nsicom.remotevm.location=\\Windows\\creme\\bin\\CrEme.exe
|
||||
obfuscated.classes.dir=${build.dir}/obfuscated
|
||||
obfuscation.custom=@E:\\SETUPS\\Disk\\Programming\\Java\\annimon.pro
|
||||
obfuscation.level=1
|
||||
obfuscator.destjar=${build.dir}/obfuscated.jar
|
||||
obfuscator.srcjar=${build.dir}/before-obfuscation.jar
|
||||
platform.active=Sony_Ericsson_SDK_2_5_0_6_for_the_Java_TM__ME_Platform_Emulator_
|
||||
platform.active.description=Sony Ericsson SDK 2.5.0.6 for the Java(TM) ME Platform(Emulator)
|
||||
platform.apis=JSR234-1.0,SATSA-APDU-1.0,capuchin-1.0,J2ME-WS-1.0,J2ME-XMLRPC-1.0,SATSA-JCRMI-1.0,SATSA-CRYPTO-1.0,JSR239-1.0,MascotV3-1.0,JSR238-1.0,MMAPI-1.1,JSR256-1.1,NokiaUI-1.0,IAPInfo-1.0,JSR229-1.1.0,SATSA-PKI-1.0,JSR180-1.0.1,JSR226-1.0,SEMC_EXT_JP8-1.0,VSCL-2.0,VSCL-2.1,eSWT-1.1,JSR75-1.0,JSR184-1.1,WMA-2.0,JSR211-1.0,JSR82-1.1,JSR177-1.0,JSR179-1.0.1
|
||||
platform.bootclasspath=${platform.home}/lib/eswt.jar:${platform.home}/lib/mascotv3.jar:${platform.home}/lib/jsr226.jar:${platform.home}/lib/jsr256.jar:${platform.home}/lib/satsa-crypto.jar:${platform.home}/lib/jsr229.jar:${platform.home}/lib/jsr238.jar:${platform.home}/lib/j2me-xmlrpc.jar:${platform.home}/lib/jsr211.jar:${platform.home}/lib/vscl21.jar:${platform.home}/lib/satsa-jcrmi.jar:${platform.home}/lib/jsr082.jar:${platform.home}/lib/satsa-apdu.jar:${platform.home}/lib/jsr184.jar:${platform.home}/lib/nokiaext.jar:${platform.home}/lib/capuchin.jar:${platform.home}/lib/jsr239.jar:${platform.home}/lib/jsr75.jar:${platform.home}/lib/satsa-pki.jar:${platform.home}/lib/jsr179.jar:${platform.home}/lib/jsr180.jar:${platform.home}/lib/iapinfo.jar:${platform.home}/lib/vscl.jar:${platform.home}/lib/mmapi.jar:${platform.home}/lib/j2me-ws.jar:${platform.home}/lib/wma20.jar:${platform.home}/lib/jsr234.jar:${platform.home}/lib/semc_ext_jp8.jar:${platform.home}/lib/cldcapi11.jar:${platform.home}/lib/midpapi20.jar
|
||||
platform.configuration=CLDC-1.1
|
||||
platform.device=SonyEricsson_JP8_240x320_Emu
|
||||
platform.fat.jar=true
|
||||
platform.profile=MIDP-2.0
|
||||
platform.trigger=CLDC
|
||||
platform.type=UEI-1.0.1
|
||||
preprocessed.dir=${build.dir}/preprocessed
|
||||
preverify.classes.dir=${build.dir}/preverified
|
||||
preverify.sources.dir=${build.dir}/preverifysrc
|
||||
resources.dir=resources
|
||||
ricoh.application.email=
|
||||
ricoh.application.fax=
|
||||
ricoh.application.icon=
|
||||
ricoh.application.target-jar=
|
||||
ricoh.application.telephone=
|
||||
ricoh.application.uid=51003948
|
||||
ricoh.application.version=
|
||||
ricoh.dalp.application-desc.auto-run=false
|
||||
ricoh.dalp.application-desc.energy-save=
|
||||
ricoh.dalp.application-desc.exec-auth=
|
||||
ricoh.dalp.application-desc.visible=true
|
||||
ricoh.dalp.argument=
|
||||
ricoh.dalp.codebase=
|
||||
ricoh.dalp.display-mode.color=true
|
||||
ricoh.dalp.display-mode.is-4line-support=false
|
||||
ricoh.dalp.display-mode.is-hvga-support=true
|
||||
ricoh.dalp.display-mode.is-vga-support=false
|
||||
ricoh.dalp.display-mode.is-wvga-support=false
|
||||
ricoh.dalp.information.abbreviation=
|
||||
ricoh.dalp.information.icon.basepath=
|
||||
ricoh.dalp.information.icon.location=
|
||||
ricoh.dalp.information.is-icon-used=true
|
||||
ricoh.dalp.install.destination=hdd
|
||||
ricoh.dalp.install.mode.auto=true
|
||||
ricoh.dalp.install.work-dir=hdd
|
||||
ricoh.dalp.is-managed=true
|
||||
ricoh.dalp.resources.dsdk.version=2.0
|
||||
ricoh.dalp.resources.jar.basepath=
|
||||
ricoh.dalp.resources.jar.version=
|
||||
ricoh.dalp.version=
|
||||
ricoh.icon.invert=false
|
||||
ricoh.platform.target.version=
|
||||
run.cmd.options=
|
||||
run.jvmargs=
|
||||
run.method=STANDARD
|
||||
run.security.domain=trusted
|
||||
run.use.security.domain=false
|
||||
savaje.application.icon=
|
||||
savaje.application.icon.focused=
|
||||
savaje.application.icon.small=
|
||||
savaje.application.uid=TBD
|
||||
savaje.bundle.base=
|
||||
savaje.bundle.debug=false
|
||||
savaje.bundle.debug.port=
|
||||
semc.application.caps=
|
||||
semc.application.icon=
|
||||
semc.application.icon.count=
|
||||
semc.application.icon.splash=
|
||||
semc.application.icon.splash.installonly=false
|
||||
semc.application.uid=E8047253
|
||||
semc.certificate.path=
|
||||
semc.private.key.password=
|
||||
semc.private.key.path=
|
||||
sign.alias=
|
||||
sign.enabled=false
|
||||
sign.keystore=
|
||||
src.dir=src
|
||||
use.emptyapis=true
|
||||
use.preprocessor=true
|
10
nbproject/project.xml
Normal file
10
nbproject/project.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.kjava.j2meproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2me-project">
|
||||
<name>LetItSnow</name>
|
||||
<minimum-ant-version>1.6</minimum-ant-version>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
@ -22,7 +22,8 @@ public class DrawParticles extends Canvas implements Runnable {
|
||||
/* Время, после которого меняется направление ветра */
|
||||
private long timeToChangeWind;
|
||||
private Background bg;
|
||||
private Image background;
|
||||
private Graphics G;
|
||||
private Image background, I;
|
||||
private Vector particles;
|
||||
|
||||
|
||||
@ -30,6 +31,8 @@ public class DrawParticles extends Canvas implements Runnable {
|
||||
setFullScreenMode(true);
|
||||
w = getWidth();
|
||||
h = getHeight();
|
||||
I = Image.createImage(w, h);
|
||||
G = I.getGraphics();
|
||||
autoChangeTime = true;
|
||||
hour = Util.getHour();
|
||||
speed = MIN_SPEED;
|
||||
@ -39,19 +42,25 @@ public class DrawParticles extends Canvas implements Runnable {
|
||||
bg = new Background(w, h);
|
||||
background = bg.generateImage();
|
||||
particles = new Vector();
|
||||
for (int i = 0; i < (h/64); i++) {
|
||||
particles.addElement(new Snow(w, h, MAX_SNOW));
|
||||
}
|
||||
//for (int i = 0; i < (h/64); i++) {
|
||||
particles.addElement(new Snow(w, h, MAX_SNOW*(h/64)));
|
||||
//}
|
||||
new Thread(this).start();
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
draw(G);
|
||||
g.drawImage(I, 0, 0, 20);
|
||||
}
|
||||
|
||||
private void draw(Graphics g) {
|
||||
g.drawImage(background, 0, 0, 20);
|
||||
bg.drawStar(g);
|
||||
// рисуем системы
|
||||
for (int i = 0; i < particles.size(); i++) {
|
||||
int i = 0;
|
||||
//for (int i = 0; i < particles.size(); i++) {
|
||||
((ParticleSystem) particles.elementAt(i)).render(g);
|
||||
}
|
||||
//}
|
||||
// эффекты времени суток
|
||||
if (Parameters.timeEffects) bg.postDraw(g);
|
||||
// инфа
|
||||
@ -173,6 +182,9 @@ public class DrawParticles extends Canvas implements Runnable {
|
||||
} else if (key == KEY_NUM9) {
|
||||
Parameters.timeEffects = !Parameters.timeEffects;
|
||||
}
|
||||
else if (key == KEY_NUM0) {
|
||||
Main.midlet.destroyApp(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
import java.util.Vector;
|
||||
import javax.microedition.lcdui.Graphics;
|
||||
|
||||
/*
|
||||
@ -12,13 +13,13 @@ import javax.microedition.lcdui.Graphics;
|
||||
*/
|
||||
public abstract class ParticleSystem {
|
||||
|
||||
/* Массив частицы */
|
||||
protected Point3D[] particles;
|
||||
/* Массив частиц */
|
||||
protected Vector particles;
|
||||
protected Rectangle window;
|
||||
|
||||
public ParticleSystem(int x, int y, int w, int h, int numOfParticles) {
|
||||
window = new Rectangle(x, y, w, h);
|
||||
particles = new Point3D[numOfParticles];
|
||||
particles = new Vector();
|
||||
}
|
||||
|
||||
/* Отрисовка системы частиц */
|
||||
@ -33,16 +34,26 @@ public abstract class ParticleSystem {
|
||||
return resetParticle();
|
||||
}
|
||||
|
||||
/* Добавление частицы на основе заданной */
|
||||
protected Point3D addParticle(Point3D object) {
|
||||
return resetParticle(object);
|
||||
}
|
||||
|
||||
/* Сброс свойств частицы */
|
||||
protected abstract Point3D resetParticle();
|
||||
/* Сброс свойств частицы к заданным */
|
||||
protected abstract Point3D resetParticle(Point3D object);
|
||||
/* Обновление свойств частиц */
|
||||
protected abstract void update();
|
||||
/* Отрисовка частиц */
|
||||
protected abstract void draw(Graphics g);
|
||||
|
||||
|
||||
|
||||
/* Точка в 3D */
|
||||
protected class Point3D {
|
||||
float x, y, z;
|
||||
boolean enable;
|
||||
}
|
||||
|
||||
/* Прямоугольник */
|
||||
|
109
src/Snow.java
109
src/Snow.java
@ -25,8 +25,8 @@ public class Snow extends ParticleSystem {
|
||||
public Snow(int w, int h, int numOfParticles) {
|
||||
super(0, 0, w, h, numOfParticles);
|
||||
MAX_Z = w / 15;
|
||||
for (int i = 0; i < particles.length; i++) {
|
||||
particles[i] = addParticle();
|
||||
for (int i = 0; i < numOfParticles; i++) {
|
||||
particles.addElement(addParticle());
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ public class Snow extends ParticleSystem {
|
||||
/* Начальные свойства снежинки */
|
||||
protected Point3D resetParticle() {
|
||||
Point3D snow = new Point3D();
|
||||
snow.enable = true;
|
||||
snow.z = Util.random(1, MAX_Z);
|
||||
int w_x = (int) (window.x / snow.z);
|
||||
int w_y = (int) (window.y / snow.z);
|
||||
@ -55,51 +56,83 @@ public class Snow extends ParticleSystem {
|
||||
return snow;
|
||||
}
|
||||
|
||||
/* Начальные свойства снежинки на основе заданной */
|
||||
protected Point3D resetParticle(Point3D src) {
|
||||
Point3D snow = new Point3D();
|
||||
snow.enable = true;
|
||||
snow.z = src.z;
|
||||
int w_x = (int) (window.x / snow.z);
|
||||
int w_y = (int) (window.y / snow.z);
|
||||
int w_w = (int) (window.w * snow.z);
|
||||
int w_h = (int) (window.h * snow.z);
|
||||
snow.x = Util.random(w_x, w_w);
|
||||
// создаём снежинки за экраном
|
||||
snow.y = Util.random(w_y, w_h);
|
||||
|
||||
return snow;
|
||||
}
|
||||
|
||||
protected void update() {
|
||||
for (int i = 0; i < particles.length; i++) {
|
||||
particles[i].x += 2*Math.cos(windAngle);// ветер по X
|
||||
particles[i].z += 0.01f*Math.sin(windAngle);// ветер по Z
|
||||
particles[i].y = particles[i].y + speed + 0.981f; // скорость + притяжение
|
||||
if (particles[i].z < MIN_Z) {
|
||||
particles[i].z = MAX_Z;
|
||||
particles[i].x = Util.random((int) (window.x / particles[i].z),
|
||||
(int) (window.h * particles[i].z));
|
||||
particles[i].y = window.y-Util.random(0, 10);
|
||||
} else if (particles[i].z > MAX_Z) {
|
||||
particles[i].x = window.w + Util.random(0, 10);
|
||||
particles[i].y = Util.random((int) (window.y / particles[i].z),
|
||||
(int) (window.w * particles[i].z));
|
||||
particles[i].z = MIN_Z;
|
||||
int size = particles.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Point3D particle = (Point3D) particles.elementAt(i);
|
||||
if (!particle.enable) continue;
|
||||
particle.x += 2*Math.cos(windAngle);// ветер по X
|
||||
particle.z += 0.01f*Math.sin(windAngle);// ветер по Z
|
||||
particle.y = particle.y + speed + 0.981f; // скорость + притяжение
|
||||
if (particle.z < MIN_Z) {
|
||||
particle.z = MAX_Z;
|
||||
particle.x = Util.random((int) (window.x / particle.z),
|
||||
(int) (window.h * particle.z));
|
||||
particle.y = window.y-Util.random(0, 10);
|
||||
} else if (particle.z > MAX_Z) {
|
||||
particle.x = window.w + Util.random(0, 10);
|
||||
particle.y = Util.random((int) (window.y / particle.z),
|
||||
(int) (window.w * particle.z));
|
||||
particle.z = MIN_Z;
|
||||
}
|
||||
int x = (int) (particles[i].x / particles[i].z);
|
||||
int y = (int) (particles[i].y / particles[i].z);
|
||||
int w_x = (int) (window.x / particles[i].z);
|
||||
int w_y = (int) (window.y / particles[i].z);
|
||||
int w_w = (int) (window.w * particles[i].z);
|
||||
int x = (int) (particle.x / particle.z);
|
||||
int y = (int) (particle.y / particle.z);
|
||||
int w_x = (int) (window.x / particle.z);
|
||||
int w_y = (int) (window.y / particle.z);
|
||||
int w_w = (int) (window.w * particle.z);
|
||||
int wind_x = (int) (2*Math.cos(windAngle));
|
||||
int y_max = (int) (window.h - (particles[i].z * window.h/3)/MAX_Z);
|
||||
if (y > y_max) {//if (y > window.h) {
|
||||
if (wind_x > 0) particles[i].x = Util.random(w_x-wind_x*10, w_w);
|
||||
else if (wind_x < 0) particles[i].x = Util.random(w_x, w_w-wind_x*10);
|
||||
else particles[i].x = Util.random(w_x, w_w);
|
||||
particles[i].y = w_y - Util.random(0, 10);
|
||||
} else if (particles[i].x > w_w) {
|
||||
if (wind_x > 0) particles[i].x = w_x-Util.random(0, 10);
|
||||
int y_max = (int) (window.h - (particle.z * window.h/3)/MAX_Z);
|
||||
if (y > y_max) {
|
||||
// Упало на землю
|
||||
if (wind_x > 0) particle.x = Util.random(w_x-wind_x*10, w_w);
|
||||
else if (wind_x < 0) particle.x = Util.random(w_x, w_w-wind_x*10);
|
||||
else particle.x = Util.random(w_x, w_w);
|
||||
// Если снежинка возле экрана и такой еще нет
|
||||
boolean contain = particles.contains(particle);
|
||||
if ( (particle.z < (MAX_Z/3)) && (particles.size() < 700) && contain ) {
|
||||
// То исключаем её из обработки
|
||||
// и добавляем новую
|
||||
particle.enable = false;
|
||||
particles.addElement(addParticle(particle));
|
||||
} else {
|
||||
// Иначе перемещаем её вверх
|
||||
particle.y = w_y - Util.random(0, 10);
|
||||
}
|
||||
} else if (particle.x > w_w) {
|
||||
if (wind_x > 0) particle.x = w_x-Util.random(0, 10);
|
||||
} else if (x < w_x) {
|
||||
particles[i].x = w_w+Util.random(0, 10);
|
||||
particles[i].y = Util.random((int) (window.y / particles[i].z),
|
||||
(int) (window.w * particles[i].z));
|
||||
particle.x = w_w+Util.random(0, 10);
|
||||
particle.y = Util.random((int) (window.y / particle.z),
|
||||
(int) (window.w * particle.z));
|
||||
}
|
||||
particles.setElementAt(particle, i);
|
||||
}
|
||||
}
|
||||
|
||||
protected void draw(Graphics g) {
|
||||
for (int i = 0; i < particles.length; i++) {
|
||||
if (particles[i].z < MIN_Z) continue;
|
||||
g.setColor(Util.colorFromBrightness(255 - (int)(particles[i].z * (128 / MAX_Z))));
|
||||
int x = (int) (particles[i].x / particles[i].z);
|
||||
int y = (int) (particles[i].y / particles[i].z);
|
||||
int radius = (int) (MAX_Z / particles[i].z);
|
||||
for (int i = 0; i < particles.size(); i++) {
|
||||
Point3D particle = (Point3D) particles.elementAt(i);
|
||||
if (particle.z < MIN_Z) continue;
|
||||
g.setColor(Util.colorFromBrightness(255 - (int)(particle.z * (128 / MAX_Z))));
|
||||
int x = (int) (particle.x / particle.z);
|
||||
int y = (int) (particle.y / particle.z);
|
||||
int radius = (int) (MAX_Z / particle.z);
|
||||
if (radius < 2) g.drawLine(x, y, x, y);
|
||||
else drawSnow(g, x, y, radius);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user