Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/blink/src/world_entities/effects/blink.cc @ 10427

Last change on this file since 10427 was 10427, checked in by stefalie, 17 years ago

blink: cleanup

File size: 2.2 KB
Line 
1/*
2
3   Copyright (C) 2006 orx
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2, or (at your option)
8   any later version.
9
10### File Specific:
11   main-programmer:
12*/
13
14#include "blink.h"
15
16#include "util/loading/load_param.h"
17#include "util/loading/factory.h"
18#include "debug.h"
19#include "state.h"
20#include "effects/billboard.h"
21
22#include "material.h"
23
24
25
26
27
28
29ObjectListDefinition(Blink);
30CREATE_FACTORY(Blink);
31
32/**
33 * standart constructor
34 */
35Blink::Blink (const TiXmlElement* root)
36{
37  this->init();
38
39  if( root)
40    this->loadParams(root);
41
42//   this->bBoard->setSize(this->size, this->size);
43}
44
45
46/**
47 * destroys a Blink
48 */
49Blink::~Blink ()
50{
51//  if (this->material)
52  //  delete this->material;
53}
54
55
56/**
57 * initializes the Blink
58 */
59void Blink::init()
60{
61  this->registerObject(this, Blink::_objectList);
62  this->setName("Blink");
63
64  this->toList(OM_COMMON);
65
66  this->bBoard = new Billboard;
67  this->bBoard->setVisibiliy(true);
68  this->bBoard->setTexture("maps/star_alpha.png");
69  this->bBoard->setAbsCoor(this->position.x, this->position.y, this->position.z);
70
71
72  /// Standard values
73  this->setAbsCoor(0, 0, 0); 
74  this->position = Vector(0, 0, 0); ///remove
75  this->color = Color(1, 0, 0);
76  this->size = 10;
77  this->omega = 10;
78  this->angle = rand() % 1000;
79  PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle);
80  this->angle *= 2 * M_PI;
81  PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle);
82}
83
84
85/**
86 *  load params
87 * @param root TiXmlElement object
88 */
89void Blink::loadParams(const TiXmlElement* root)
90{
91  WorldEntity::loadParams(root);
92
93  LoadParam(root, "position", this, Blink, setPosition);
94  LoadParam(root, "size", this, Blink, setSize);
95  LoadParam(root, "color", this, Blink, setColor);
96  LoadParam(root, "omega", this, Blink, setOmega);
97}
98
99
100/**
101 * ticks the Blink
102 * @param dt the time to ticks
103 */
104void Blink::tick(float dt)
105{
106  this->angle += dt * this->omega;
107
108  if (this->angle > 2 * M_PI)
109    this->angle -= 2 * M_PI;
110
111  this->blinkStr = sinf(angle);
112
113  this->bBoard->colorTexture(Color(color.r(), color.g(), color.b(), 1));
114}
115
116
117/**
118 * draws the blink
119 */
120void Blink::draw() const
121{
122
123}
Note: See TracBrowser for help on using the repository browser.