upload
This commit is contained in:
parent
593471a901
commit
97391a42af
117
src/particle.hpp
Normal file
117
src/particle.hpp
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
//
|
||||||
|
// particle.hpp
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 16.04.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ofMain.h"
|
||||||
|
|
||||||
|
#include "objectPhysics.hpp"
|
||||||
|
#include "visitor.hpp"
|
||||||
|
#include "checkedInVisitor.hpp"
|
||||||
|
|
||||||
|
enum typeOfView{
|
||||||
|
|
||||||
|
LOGIC,
|
||||||
|
MAPPED
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum particleMode{
|
||||||
|
|
||||||
|
PARTICLE_MODE_DEFAULT,
|
||||||
|
PARTICLE_MODE_POLYMESH,
|
||||||
|
PARTICLE_MODE_RFID,
|
||||||
|
PARTICLE_MODE_TORNADO
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Particle {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Particle();
|
||||||
|
Particle(ofVec2f _position);
|
||||||
|
|
||||||
|
~Particle();
|
||||||
|
|
||||||
|
void setup(ofVec2f position, float sceneHeight);
|
||||||
|
bool isTheSetupPositionOnTheGround(ofVec2f position, float sceneHeight);
|
||||||
|
|
||||||
|
void update(float deltaT, particleMode currentModeParticle, vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors, float sceneWidth, float sceneHeight);
|
||||||
|
|
||||||
|
void draw(typeOfView activeTypeOfView);
|
||||||
|
|
||||||
|
float getMaxLife();
|
||||||
|
float getAgeNorm();
|
||||||
|
float getAngle();
|
||||||
|
ofVec2f getPosition();
|
||||||
|
|
||||||
|
void setRandomVelocity();
|
||||||
|
void setRandomVelocityOnlyGoingUp();
|
||||||
|
|
||||||
|
void updateColor();
|
||||||
|
// void setColor(int r, int g, int b);
|
||||||
|
|
||||||
|
void attractParticle(vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors);
|
||||||
|
|
||||||
|
void updateAngleToCenter(float centerX, float centerY);
|
||||||
|
void updateDistanceToCenter(float centerX, float centerY, float sceneHeight);
|
||||||
|
|
||||||
|
|
||||||
|
bool particleIsOnGround;
|
||||||
|
bool particleJumpedOffGround;
|
||||||
|
bool particleJumpedOnGround;
|
||||||
|
|
||||||
|
void mapParticle(float sceneWidth, float sceneHeight);
|
||||||
|
bool borderCollission();
|
||||||
|
|
||||||
|
typeOfView activeTypeOfView;
|
||||||
|
|
||||||
|
particleMode currentMode;
|
||||||
|
particleMode lastMode;
|
||||||
|
|
||||||
|
float sceneWidth;
|
||||||
|
float sceneHeight;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
ofVec2f velocity;
|
||||||
|
ofVec2f position;
|
||||||
|
ofVec2f mappedPosition;
|
||||||
|
|
||||||
|
float factorOfSlowingDown;
|
||||||
|
float activeSlowingDown;
|
||||||
|
float factorOfSpeedingUp;
|
||||||
|
float activeSpeedingUp;
|
||||||
|
|
||||||
|
//Mapping information
|
||||||
|
float angleToCenter;
|
||||||
|
|
||||||
|
float distanceToCenter;
|
||||||
|
float distanceToCenterLastFrame;
|
||||||
|
|
||||||
|
float age;
|
||||||
|
float maxLife;
|
||||||
|
bool aging;
|
||||||
|
|
||||||
|
float size;
|
||||||
|
float scaleFactorPerDeltaT;
|
||||||
|
|
||||||
|
float mass;
|
||||||
|
|
||||||
|
|
||||||
|
ofColor color;
|
||||||
|
|
||||||
|
|
||||||
|
int stele;
|
||||||
|
//on which "stele" is the particle? --> will affect the movement (mapping), when it reaches borders of its "stele" !
|
||||||
|
//if border 1/2/3/4 (<,>,v,^), then map particle
|
||||||
|
|
||||||
|
};
|
305
src/particleSystem.cpp
Normal file
305
src/particleSystem.cpp
Normal file
@ -0,0 +1,305 @@
|
|||||||
|
//
|
||||||
|
// particleSystem.cpp
|
||||||
|
// emptyExample
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 16.04.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "particleSystem.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ParticleSystem::ParticleSystem(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
ParticleSystem::~ParticleSystem(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ParticleSystem::setup(){
|
||||||
|
|
||||||
|
|
||||||
|
// xmlParticleSystems.loadFile("xml/particleSystem.xml");
|
||||||
|
|
||||||
|
// this->particles.push_back(new Particle);
|
||||||
|
|
||||||
|
// std::cout << "breakpoint particleSystem_1 erreicht, particleSystem_setup beendet" << std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
//*** PARTICLESYSTEM UPDATE *** PARTICLESYSTEM UPDATE *** PARTICLESYSTEM UPDATE *** PARTICLESYSTEM UPDATE ***
|
||||||
|
|
||||||
|
|
||||||
|
void ParticleSystem::update(float deltaT, particleMode currentMode, vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors, float sceneWidth, float sceneHeight){
|
||||||
|
|
||||||
|
|
||||||
|
//preparation
|
||||||
|
|
||||||
|
double DELTA_T_IN_SECONDS = deltaT/1000;
|
||||||
|
|
||||||
|
this->currentMode = currentMode;
|
||||||
|
|
||||||
|
// *** PARTICLESYSTEM SWITCH *** PARTICLESYSTEM SWITCH *** PARTICLESYSTEM SWITCH *** PARTICLESYSTEM SWITCH ***
|
||||||
|
|
||||||
|
|
||||||
|
//If the particlesystem itself needs some logic, it will happen in the following switch!
|
||||||
|
|
||||||
|
|
||||||
|
switch ( currentMode )
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
case PARTICLE_MODE_DEFAULT: {
|
||||||
|
|
||||||
|
|
||||||
|
//what does the particle system do if its mode is 'PARTICLE_MODE_DEFAULT'
|
||||||
|
|
||||||
|
|
||||||
|
// value a = xmlParticleSystems.getValue (" default:..." , 0 ) ;
|
||||||
|
// value b = xmlParticleSystems.getValue (" default:..." , 0 ) ;
|
||||||
|
// value c = xmlParticleSystems.getValue (" default:..." , 0 ) ;
|
||||||
|
// value d = xmlParticleSystems.getValue (" default:..." , 0 ) ;
|
||||||
|
// value e ....
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// PARTICLESYSTEM_BIRTHRATE = xmlParticleSystems.getValue("default:birthrate", 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PARTICLESYSTEM_BIRTHRATE = 1; //testing default
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// std::cout << "birthrate from xml: " + ofToString(PARTICLESYSTEM_BIRTHRATE) << std::endl;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
case PARTICLE_MODE_POLYMESH: {
|
||||||
|
|
||||||
|
//what does the particle system do if its mode is 'PARTICLE_MODE_POLYMESH'
|
||||||
|
|
||||||
|
PARTICLESYSTEM_BIRTHRATE = 0;
|
||||||
|
updateLines(currentMode, objectPhysics);
|
||||||
|
|
||||||
|
// PARTICLESYSTEM_BIRTHRATE = xmlParticleSystems.getValue("polymesh:birthrate", 0);
|
||||||
|
int PARTICLESYSTEM_BIRTHRATE_CHECKEDINVISITORS = 4;
|
||||||
|
|
||||||
|
while (PRODUCED_PER_EMITTER < PARTICLESYSTEM_BIRTHRATE_CHECKEDINVISITORS){
|
||||||
|
|
||||||
|
for(int i = 0; i < checkedInVisitors->size(); i++){
|
||||||
|
|
||||||
|
if( checkedInVisitors->at(i)->getAge() <= 7){
|
||||||
|
|
||||||
|
this->particles.push_back(new Particle);
|
||||||
|
|
||||||
|
particles.back()->setup(checkedInVisitors->at(i)->getBottom(), sceneHeight);
|
||||||
|
|
||||||
|
particles.back()->setRandomVelocityOnlyGoingUp();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER = 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
case PARTICLE_MODE_RFID: {
|
||||||
|
|
||||||
|
|
||||||
|
//what does the particle system do if its mode is 'PARTICLE_MODE_RFID'
|
||||||
|
|
||||||
|
while (PRODUCED_PER_EMITTER < PARTICLESYSTEM_BIRTHRATE){
|
||||||
|
|
||||||
|
for(int i = 0; i < checkedInVisitors->size(); i++){
|
||||||
|
|
||||||
|
if( checkedInVisitors->at(i)->getAge() <= 5){
|
||||||
|
|
||||||
|
this->particles.push_back(new Particle);
|
||||||
|
|
||||||
|
particles.back()->setup(checkedInVisitors->at(i)->getBottom(), sceneHeight);
|
||||||
|
|
||||||
|
particles.back()->setRandomVelocityOnlyGoingUp();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
default: {
|
||||||
|
|
||||||
|
//following two lines only help for compiling right now
|
||||||
|
|
||||||
|
int a = 0;
|
||||||
|
a++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end of switch
|
||||||
|
|
||||||
|
// std::cout << "breakpoint particleSystem_2 erreicht, switch anweisung beendet" << std::endl;
|
||||||
|
|
||||||
|
// *** BIRTH CONTROL *** BIRTH CONTROL *** BIRTH CONTROL ***
|
||||||
|
|
||||||
|
//the system will emit a new particle for every emitter, as long as the PRODUCED_PER_EMITTER is smaller than the wanted BIRTHRATE
|
||||||
|
//PPE is growing until it reaches deltaT, so the while statement will be executed more often, if deltaT gets bigger
|
||||||
|
//as long as the birthcount grows and is lower then the birthrate (depending on the mode (XML) ) it will emit once for every emitter
|
||||||
|
//that is active (bool emitting = true)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while (PRODUCED_PER_EMITTER < PARTICLESYSTEM_BIRTHRATE){
|
||||||
|
|
||||||
|
for(int i = 0; i < objectPhysics->size(); i++){
|
||||||
|
|
||||||
|
// if(( (*objectPhysics).at(i)->type == "emitter" ) && (objectPhysics->at(i)->emitting == true)){
|
||||||
|
if( objectPhysics->at(i)->emitting == true){
|
||||||
|
|
||||||
|
this->particles.push_back(new Particle);
|
||||||
|
|
||||||
|
particles.back()->setup(objectPhysics->at(i)->getPosition(), sceneHeight);
|
||||||
|
if(objectPhysics->at(i)->type == "emitterOnStele"){
|
||||||
|
particles.back()->setRandomVelocityOnlyGoingUp();
|
||||||
|
}else{
|
||||||
|
particles.back()->setRandomVelocity();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER++;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRODUCED_PER_EMITTER = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// *** PARTICLE SYSTEM UPDATING ITS PARTICLES *** *** PARTICLE SYSTEM UPDATING ITS PARTICLES *** PARTICLE SYSTEM UPDATING ITS PARTICLES ***
|
||||||
|
|
||||||
|
//for "alle partikel im system" update in abhängigkeit vom übergebenen "mode"
|
||||||
|
//The following lines will start working, when Particle::update has been reworked is active and particleMode implemented
|
||||||
|
|
||||||
|
for (int p = 0; p < particles.size(); p++){
|
||||||
|
|
||||||
|
particles.at(p)->update(deltaT, currentMode, objectPhysics, checkedInVisitors, sceneWidth, sceneHeight);
|
||||||
|
|
||||||
|
//Delete particles that reached maxAge
|
||||||
|
if(currentMode != PARTICLE_MODE_POLYMESH){
|
||||||
|
if (particles.at(p)->getAgeNorm() > 1) {
|
||||||
|
delete particles.at(p);
|
||||||
|
particles.erase(particles.begin() + p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void ParticleSystem::draw(typeOfView activeTypeOfView){
|
||||||
|
|
||||||
|
for(int i = 0; i < particles.size(); i++){
|
||||||
|
|
||||||
|
particles.at(i)->draw(activeTypeOfView);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( currentMode == PARTICLE_MODE_POLYMESH){
|
||||||
|
for(int i = 0; i < lines.size(); i++){
|
||||||
|
|
||||||
|
ofDrawLine(lines.at(i)->point1, lines.at(i)->point2);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
void ParticleSystem::updateLines(particleMode currentMode, vector<ObjectPhysics*>* objectPhysics){
|
||||||
|
|
||||||
|
lines.clear();
|
||||||
|
|
||||||
|
if(currentMode == PARTICLE_MODE_POLYMESH){
|
||||||
|
|
||||||
|
for(int i = 0; i < objectPhysics->size(); i++){
|
||||||
|
|
||||||
|
if(( (*objectPhysics).at(i)->type == "attraktor" ) && (objectPhysics->at(i)->attracting == true)){
|
||||||
|
|
||||||
|
for(int p = 0; p < particles.size(); p++){
|
||||||
|
|
||||||
|
if(particles.at(p)->particleIsOnGround==true){
|
||||||
|
|
||||||
|
ofVec2f distance = particles.at(p)->getPosition() - objectPhysics->at(i)->getPosition();
|
||||||
|
|
||||||
|
if(distance.length() < 150){
|
||||||
|
|
||||||
|
lines.push_back(new Line(particles.at(p)->getPosition(), objectPhysics->at(i)->getPosition()));
|
||||||
|
|
||||||
|
for(int p2 = 0; p2 < particles.size(); p2++){
|
||||||
|
|
||||||
|
ofVec2f distance = particles.at(p)->getPosition() - particles.at(p2)->getPosition();
|
||||||
|
|
||||||
|
if(distance.length() < 50){
|
||||||
|
|
||||||
|
lines.push_back(new Line(particles.at(p)->getPosition(), particles.at(p2)->getPosition()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
p2 += 4; //lower value -> worse performance & nicer effect (more connections between the particles)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// p += 2 ; //if your system shows performance issues you might need to activate this line! (downside: effect seems to jump)
|
||||||
|
|
||||||
|
}
|
||||||
|
} //end of for schleife
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
85
src/particleSystem.hpp
Normal file
85
src/particleSystem.hpp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
//
|
||||||
|
// particleSystem.hpp
|
||||||
|
// emptyExample
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 16.04.19.
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "ofxXmlSettings.h"
|
||||||
|
#include "particle.hpp"
|
||||||
|
|
||||||
|
#include "objectPhysics.hpp"
|
||||||
|
#include "checkedInVisitor.hpp"
|
||||||
|
|
||||||
|
//class Line will be used to draw the polymesh
|
||||||
|
|
||||||
|
class Line {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Line();
|
||||||
|
Line(ofPoint p1, ofPoint p2){
|
||||||
|
point1 = p1;
|
||||||
|
point2= p2;
|
||||||
|
};
|
||||||
|
~Line();
|
||||||
|
|
||||||
|
ofPoint point1;
|
||||||
|
ofPoint point2;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ParticleSystem {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ParticleSystem();
|
||||||
|
~ParticleSystem();
|
||||||
|
|
||||||
|
|
||||||
|
void setup();
|
||||||
|
void update(float deltaT, particleMode mode, vector<ObjectPhysics*>* objectPhysics, vector<CheckedInVisitor*>* checkedInVisitors, float sceneWidth, float sceneHeight);
|
||||||
|
void draw(typeOfView activeTypeOfView);
|
||||||
|
|
||||||
|
|
||||||
|
void updateLines(particleMode currentMode, vector<ObjectPhysics*>* objectPhysics);
|
||||||
|
|
||||||
|
|
||||||
|
particleMode currentMode;
|
||||||
|
|
||||||
|
ofxXmlSettings xmlParticleSystems;
|
||||||
|
ofxXmlSettings xmlParticles; // ??? wo soll das hin ???
|
||||||
|
|
||||||
|
vector<Particle*> particles;
|
||||||
|
|
||||||
|
vector<Line*> lines;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
int playerType;
|
||||||
|
//Global for particleSystems-birthrate -> can be used to emit faster/slower
|
||||||
|
|
||||||
|
int PARTICLESYSTEM_BIRTHRATE;
|
||||||
|
int PRODUCED_PER_EMITTER;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
171
src/visitor.cpp
Normal file
171
src/visitor.cpp
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
//
|
||||||
|
// visitor.cpp
|
||||||
|
// particle_combined
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 11.06.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "visitor.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Visitor::Visitor()
|
||||||
|
{
|
||||||
|
|
||||||
|
// ofRunApp.VISITOR_COUNT++;
|
||||||
|
|
||||||
|
std::cout << "Konstruktor visitor" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
Visitor::~Visitor()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Visitor::setup(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Visitor::setup(float _x, float _y){
|
||||||
|
|
||||||
|
position.x = _x;
|
||||||
|
position.y = _y;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Visitor::update(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Visitor::draw(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ofVec2f Visitor::getPosition(){
|
||||||
|
|
||||||
|
return position;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
float Visitor::getX(){
|
||||||
|
|
||||||
|
return position.x;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
float Visitor::getY(){
|
||||||
|
|
||||||
|
return position.y;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Visitor::setPosition(float _x, float _y){
|
||||||
|
|
||||||
|
position.x = _x;
|
||||||
|
position.y = _y;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Visitor::setPosition(ofVec2f _position){
|
||||||
|
|
||||||
|
position = _position;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Visitor::setX(float _x){
|
||||||
|
|
||||||
|
position.x = _x;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void Visitor::setY(float _y){
|
||||||
|
|
||||||
|
position.y = _y;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
48
src/visitor.hpp
Normal file
48
src/visitor.hpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
//
|
||||||
|
// visitor.hpp
|
||||||
|
// particle_combined
|
||||||
|
//
|
||||||
|
// Created by Sebastian Holzki on 11.06.19.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ofMain.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Visitor {
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Visitor();
|
||||||
|
~Visitor();
|
||||||
|
|
||||||
|
void setup();
|
||||||
|
void setup(float _x, float _y);
|
||||||
|
void update();
|
||||||
|
void draw();
|
||||||
|
|
||||||
|
|
||||||
|
//GETTERS
|
||||||
|
ofVec2f getPosition();
|
||||||
|
float getX();
|
||||||
|
float getY();
|
||||||
|
|
||||||
|
//SETTERS
|
||||||
|
void setPosition(float x, float y);
|
||||||
|
void setPosition(ofVec2f position);
|
||||||
|
void setX(float _x);
|
||||||
|
void setY(float _y);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
ofVec2f position;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user