18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
1

Растёт скорость таймера

14.06.2013, 20:33. Показов 2308. Ответов 22
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Добрый день. Нужно сделать аквариум, но пока это просто кубики (вместо рыбок). При столкновении, рыбки спариваются и образуется новая рыбка Но проблема в том, что с каждым разом кубики становятся всё быстрее и пролетают сквозь друг-друга. Подскажите что делать?

exe и cpp во вложении.

Буду очень благодарен тому, кто поможет Уже неделю вожусь с этой работой...

P.S. Заметил, что время жизни новых рыбок уменьшается, следовательно таймер вызывается чаще, может по этому они не успевают проходить проверку на столкновение?
Вложения
Тип файла: zip Debug.zip (277.4 Кб, 22 просмотров)
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
14.06.2013, 20:33
Ответы с готовыми решениями:

При какой плотности тока в растворе AgNO3 толщина выделяющегося серебра растёт со скорость 1 мм/ч
При какой плотности тока в растворе AgNO3 толщина выделяющегося серебра растёт со скорость 1 мм/ч?...

Не растет PR
Народ, я выложил интернет-магазин на поддомене(http://shop.mp3mp4.ru) своего сайта...

Растет размер БД
Есть сайт на Wordpress. Размер базы данных MySQL в панели PHPMyAdmin равен 14МБ, а размер базы...

Рандом растет
srand(time(0)); int j=rand()%1000; char s="afasfa"; switch (message) ...

22
22 / 22 / 8
Регистрация: 20.04.2013
Сообщений: 103
14.06.2013, 21:14 2
Проверку они не успеваю провериться из за того что они быстрей двигаются и просто проскакивают те координаты. там лучше им задай от и до. например:

C++
1
2
int rib;//координаты рыбки
if(rib>5 && rib<10){/*Здесь если рыбка с рыбкой сбиваются*/}
0
18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
14.06.2013, 21:34  [ТС] 3
Цитата Сообщение от Gold_ Посмотреть сообщение
Проверку они не успеваю провериться из за того что они быстрей двигаются и просто проскакивают те координаты. там лучше им задай от и до. например:

C++
1
2
int rib;//координаты рыбки
if(rib>5 && rib<10){/*Здесь если рыбка с рыбкой сбиваются*/}
Я так и делаю:
Кликните здесь для просмотра всего текста
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
            while(tt!=NULL) {
                float a1 = (t->f->x)-(tt->f->x);
                float a2 = (t->f->y)-(tt->f->y);
                float a3 = (tt->f->x)-(t->f->x);
                float a4 = (tt->f->y)-(t->f->y);
                if((((a1<=102) && (a1>=100)) || ((a3<=102) && (a3>=100))) && (((a2>=0) && (a2<=100)) || ((a4>=0) && (a4<=100)))) {
                    t->f->dX*=-1;
                    tt->f->dX*=-1;
                    Collision(t->f,tt->f);
                }
                if((((a2<=100) && (a2>=98)) || ((a4<=100) && (a4>=98))) && (((a1>=0) && (a1<=100)) || ((a3>=0) && (a3<=100)))) {
                    t->f->dY*=-1;
                    tt->f->dY*=-1;
                    Collision(t->f,tt->f);
                }
                tt = tt->next;
            }
0
22 / 22 / 8
Регистрация: 20.04.2013
Сообщений: 103
14.06.2013, 21:42 4
Я тогда думаю надо сделать таймер стабильный чтобы рыбки не разгонялись.
0
18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
14.06.2013, 21:49  [ТС] 5
Цитата Сообщение от Gold_ Посмотреть сообщение
Я тогда думаю надо сделать таймер стабильный чтобы рыбки не разгонялись.
В чём заключается стабилизирование?
0
22 / 22 / 8
Регистрация: 20.04.2013
Сообщений: 103
14.06.2013, 22:16 6
Нужно написать таймер в функцию отдельную. и вызывать только 1 раз когда создаются рыбки.
0
18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
15.06.2013, 00:10  [ТС] 7
Цитата Сообщение от Gold_ Посмотреть сообщение
Нужно написать таймер в функцию отдельную. и вызывать только 1 раз когда создаются рыбки.
Он и так идёт отдельной функцией и вызывается единожды из под main(), а потом рекурсия.
0
22 / 22 / 8
Регистрация: 20.04.2013
Сообщений: 103
15.06.2013, 00:54 8
Из за чего увеличивается скорость?
0
18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
15.06.2013, 11:18  [ТС] 9
Цитата Сообщение от Gold_ Посмотреть сообщение
Из за чего увеличивается скорость?
Вот это мне и самому интересно! Не могу понять в чем проблема
0
510 / 272 / 60
Регистрация: 14.12.2010
Сообщений: 548
15.06.2013, 14:15 10
Цитата Сообщение от eisenheim Посмотреть сообщение
Вот это мне и самому интересно! Не могу понять в чем проблема
Зови glutPostRedisplay() в конце функции таймера, а не в функции отрисовки (у тебя в Draw происходит зацикливание запроса на отрисовку).
1
18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
15.06.2013, 16:36  [ТС] 11
Цитата Сообщение от EVP Посмотреть сообщение
Зови glutPostRedisplay() в конце функции таймера, а не в функции отрисовки (у тебя в Draw происходит зацикливание запроса на отрисовку).
Не помогло :'(
0
510 / 272 / 60
Регистрация: 14.12.2010
Сообщений: 548
15.06.2013, 20:28 12
Цитата Сообщение от eisenheim Посмотреть сообщение
Не помогло :'(
Умные указатели очень сильно тебе пригодятся.
Стандартные контейнеры обычно вполне себе ничего и ими нужно пользоваться.

Вообщем, я немного изменил твоё творение по этой части, а то оно валилось из-за проблем с памятью.

Визуально у тебя определение столкновений ненадёжно работает..

Кликните здесь для просмотра всего текста
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#include <windows.h>
 
#include <glut.h>
//#include <GL\GLAux.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
//#pragma comment (lib, "Glaux.lib")
#pragma comment (lib, "Winmm.lib")
#include <list>
#include <vector>
#include <memory>
#include <iostream>
 
int w = 1000;
int h = 600;
int speed = 1;
int limit = 5;
int counter = 0;
int life = 20000;
 
#define DELTA_MOVE 0.5*10
 
class Fish {
public:
    bool predator;
    float x;
    float y;
    float age;
    float type;
    float r;
    float dX;
    float dY;
    Fish (const Fish& t) {
        predator = t.predator;
        x = t.x;
        y = t.y;
        age = 0;
        type = t.type;
        r = 100.0;
        dX = DELTA_MOVE;
        dY = DELTA_MOVE;
    }
    Fish(bool a, float b, float c, float d) {
        predator = a;
        x = b;
        y = c;
        age = 0;
        type = d;
        r = 100.0;
        rand();
        dX = (((float)rand()/RAND_MAX) > 0.5f? 1 : -1)*DELTA_MOVE;
        dY = (((float)rand()/RAND_MAX) > 0.5f? 1 : -1)*DELTA_MOVE;
    }
 
    void Draw() {
        glTranslatef(x,y,0);
        if(type==0)
            glColor3f(1,1,1);
        else if(type==1)
            glColor3f(0,1,1);
        else
            glColor3f(1,0,0);
        glBegin(GL_QUADS);
            glTexCoord2f(0,1); glVertex2f(0,0); 
            glTexCoord2f(1,1); glVertex2f(100,0);
            glTexCoord2f(1,0); glVertex2f(100,100);
            glTexCoord2f(0,0); glVertex2f(0,100);
        glEnd();
    }
    void Trace()
    {
        age++;
        x+=dX;
        y+=dY;
        
        if(y>=h-100) dY*=-1;
        if(y<=-h) dY*=-1;
        
        if(x>=w-100) dX*=-1;
        if(x<=-w) dX*=-1;
    }
};
 
typedef std::shared_ptr<Fish> FishPtr;
std::list<FishPtr> fishes;
 
void SKeyboard(int key, int x, int y)
{
    int delta = 5;
    switch(key)
    {
        case GLUT_KEY_LEFT:
            speed+=delta;
            break;
        case GLUT_KEY_RIGHT:
            speed-=delta;
            break;
    }
 
    if (speed < 0)
        speed = 0;
}
int fps = 0;
DWORD lastTime = 0;
void Draw()
{
    fps++;
    DWORD time = ::timeGetTime();
    if (time - lastTime > 1000)
    {
        std::cout << "fps: " << fps << std::endl;
        lastTime = time;
        fps = 0;
    }
    glClear(GL_COLOR_BUFFER_BIT);
    for(std::list<FishPtr>::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
    {
        Fish& fish = *(*iter);
        glPushMatrix();
        fish.Draw();
        glPopMatrix();
    }
    glutSwapBuffers();
    //glFlush();
}
 
void Collision(const Fish& a, const Fish& b) {
    if(a.predator==true && b.predator==false) {
        //ab.del(b);
    }
    if(b.predator==true && a.predator==false) {
        //ab.del(a);
    }
    if(a.predator==false && b.predator==false) {
        //ab.add(new Fish(false,(0),(0),0));
        if(counter<=limit) {
            FishPtr ttt(new Fish(false,a.x - b.x,a.y - b.y,0));
            if ((int)fishes.size()<limit)
                fishes.push_back(ttt);
        }
    }
    if(a.predator==true && b.predator==true) {
        //ab.add(new Fish(true,(0),(0),2));
        if(counter<limit) {
            //Fish ttt(false,a.x - b.x,a.y - b.y,0);
            FishPtr ttt(new Fish(false,rand()%1-400,rand()%1-200,0));
            if ((int)fishes.size()<limit)
                fishes.push_back(ttt);
        }
    }
}
 
void Timer(int = 0)
{
        for(std::list<FishPtr>::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
        {
            Fish& first = *(*iter);
            for(std::list<FishPtr>::iterator iterSecond = fishes.begin(); iterSecond != fishes.end(); ++iterSecond)
            {
                if (iter == iterSecond)
                    continue;
                Fish& second = *(*iterSecond);
                float a1 = (first.x)-(second.x);
                float a2 = (first.y)-(second.y);
                float a3 = (second.x)-(first.x);
                float a4 = (second.y)-(first.y);
                if((((a1<=102) && (a1>=100)) || ((a3<=102) && (a3>=100))) && (((a2>=0) && (a2<=100)) || ((a4>=0) && (a4<=100)))) {
                    first.dX*=-1;
                    second.dX*=-1;
                    Collision(first,second);
                }
                if((((a2<=100) && (a2>=98)) || ((a4<=100) && (a4>=98))) && (((a1>=0) && (a1<=100)) || ((a3>=0) && (a3<=100)))) {
                    first.dY*=-1;
                    second.dY*=-1;
                    Collision(first,second);
                }
            }
        }
        std::vector<std::list<FishPtr>::iterator> remove;
        for(std::list<FishPtr>::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
        {
            Fish& first = *(*iter);
            first.Trace();
            if(first.age >= life) remove.push_back(iter);
        }
 
        for(std::vector<std::list<FishPtr>::iterator>::iterator iter = remove.begin(); iter != remove.end(); ++iter)
        {
            fishes.erase(*iter);
        }
 
        srand(time(NULL));
        glutTimerFunc(speed, Timer, 0);
        glutPostRedisplay();
}
 
int _tmain(int argc, _TCHAR* argvOrig[])
{
    fishes.push_back(FishPtr(new Fish(true,-200,100,2)));
    fishes.push_back(FishPtr(new Fish(false,-50,0,0)));
    fishes.push_back(FishPtr(new Fish(false,150,350,1)));
    glutInit(&arg, argv);
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB );
    glutInitWindowSize(w,h);
    glMatrixMode(GL_PROJECTION);
    glutInitWindowPosition(100,200);
    glutCreateWindow("Aquarium v4.0");
 
    glClearColor(0.0,0.0,0.0,1.0);
    glLoadIdentity();
    gluOrtho2D(-w,w,-h,h);
 
    glutDisplayFunc(Draw);
    glutTimerFunc(speed, Timer, 0);
    glutSpecialFunc(SKeyboard);
 
    glutMainLoop();
}


PS:
FPS считаю через виндовую функцию, если в линуксе нужную подставь.
Собственно, у тебя проблемы не глютом, а с C++.
1
18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
15.06.2013, 21:30  [ТС] 13
Цитата Сообщение от EVP Посмотреть сообщение
Умные указатели очень сильно тебе пригодятся.
Стандартные контейнеры обычно вполне себе ничего и ими нужно пользоваться.

Вообщем, я немного изменил твоё творение по этой части, а то оно валилось из-за проблем с памятью.

Визуально у тебя определение столкновений ненадёжно работает..

Кликните здесь для просмотра всего текста
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#include <windows.h>
 
#include <glut.h>
//#include <GL\GLAux.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
//#pragma comment (lib, "Glaux.lib")
#pragma comment (lib, "Winmm.lib")
#include <list>
#include <vector>
#include <memory>
#include <iostream>
 
int w = 1000;
int h = 600;
int speed = 1;
int limit = 5;
int counter = 0;
int life = 20000;
 
#define DELTA_MOVE 0.5*10
 
class Fish {
public:
    bool predator;
    float x;
    float y;
    float age;
    float type;
    float r;
    float dX;
    float dY;
    Fish (const Fish& t) {
        predator = t.predator;
        x = t.x;
        y = t.y;
        age = 0;
        type = t.type;
        r = 100.0;
        dX = DELTA_MOVE;
        dY = DELTA_MOVE;
    }
    Fish(bool a, float b, float c, float d) {
        predator = a;
        x = b;
        y = c;
        age = 0;
        type = d;
        r = 100.0;
        rand();
        dX = (((float)rand()/RAND_MAX) > 0.5f? 1 : -1)*DELTA_MOVE;
        dY = (((float)rand()/RAND_MAX) > 0.5f? 1 : -1)*DELTA_MOVE;
    }
 
    void Draw() {
        glTranslatef(x,y,0);
        if(type==0)
            glColor3f(1,1,1);
        else if(type==1)
            glColor3f(0,1,1);
        else
            glColor3f(1,0,0);
        glBegin(GL_QUADS);
            glTexCoord2f(0,1); glVertex2f(0,0); 
            glTexCoord2f(1,1); glVertex2f(100,0);
            glTexCoord2f(1,0); glVertex2f(100,100);
            glTexCoord2f(0,0); glVertex2f(0,100);
        glEnd();
    }
    void Trace()
    {
        age++;
        x+=dX;
        y+=dY;
        
        if(y>=h-100) dY*=-1;
        if(y<=-h) dY*=-1;
        
        if(x>=w-100) dX*=-1;
        if(x<=-w) dX*=-1;
    }
};
 
typedef std::shared_ptr<Fish> FishPtr;
std::list<FishPtr> fishes;
 
void SKeyboard(int key, int x, int y)
{
    int delta = 5;
    switch(key)
    {
        case GLUT_KEY_LEFT:
            speed+=delta;
            break;
        case GLUT_KEY_RIGHT:
            speed-=delta;
            break;
    }
 
    if (speed < 0)
        speed = 0;
}
int fps = 0;
DWORD lastTime = 0;
void Draw()
{
    fps++;
    DWORD time = ::timeGetTime();
    if (time - lastTime > 1000)
    {
        std::cout << "fps: " << fps << std::endl;
        lastTime = time;
        fps = 0;
    }
    glClear(GL_COLOR_BUFFER_BIT);
    for(std::list<FishPtr>::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
    {
        Fish& fish = *(*iter);
        glPushMatrix();
        fish.Draw();
        glPopMatrix();
    }
    glutSwapBuffers();
    //glFlush();
}
 
void Collision(const Fish& a, const Fish& b) {
    if(a.predator==true && b.predator==false) {
        //ab.del(b);
    }
    if(b.predator==true && a.predator==false) {
        //ab.del(a);
    }
    if(a.predator==false && b.predator==false) {
        //ab.add(new Fish(false,(0),(0),0));
        if(counter<=limit) {
            FishPtr ttt(new Fish(false,a.x - b.x,a.y - b.y,0));
            if ((int)fishes.size()<limit)
                fishes.push_back(ttt);
        }
    }
    if(a.predator==true && b.predator==true) {
        //ab.add(new Fish(true,(0),(0),2));
        if(counter<limit) {
            //Fish ttt(false,a.x - b.x,a.y - b.y,0);
            FishPtr ttt(new Fish(false,rand()%1-400,rand()%1-200,0));
            if ((int)fishes.size()<limit)
                fishes.push_back(ttt);
        }
    }
}
 
void Timer(int = 0)
{
        for(std::list<FishPtr>::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
        {
            Fish& first = *(*iter);
            for(std::list<FishPtr>::iterator iterSecond = fishes.begin(); iterSecond != fishes.end(); ++iterSecond)
            {
                if (iter == iterSecond)
                    continue;
                Fish& second = *(*iterSecond);
                float a1 = (first.x)-(second.x);
                float a2 = (first.y)-(second.y);
                float a3 = (second.x)-(first.x);
                float a4 = (second.y)-(first.y);
                if((((a1<=102) && (a1>=100)) || ((a3<=102) && (a3>=100))) && (((a2>=0) && (a2<=100)) || ((a4>=0) && (a4<=100)))) {
                    first.dX*=-1;
                    second.dX*=-1;
                    Collision(first,second);
                }
                if((((a2<=100) && (a2>=98)) || ((a4<=100) && (a4>=98))) && (((a1>=0) && (a1<=100)) || ((a3>=0) && (a3<=100)))) {
                    first.dY*=-1;
                    second.dY*=-1;
                    Collision(first,second);
                }
            }
        }
        std::vector<std::list<FishPtr>::iterator> remove;
        for(std::list<FishPtr>::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
        {
            Fish& first = *(*iter);
            first.Trace();
            if(first.age >= life) remove.push_back(iter);
        }
 
        for(std::vector<std::list<FishPtr>::iterator>::iterator iter = remove.begin(); iter != remove.end(); ++iter)
        {
            fishes.erase(*iter);
        }
 
        srand(time(NULL));
        glutTimerFunc(speed, Timer, 0);
        glutPostRedisplay();
}
 
int _tmain(int argc, _TCHAR* argvOrig[])
{
    fishes.push_back(FishPtr(new Fish(true,-200,100,2)));
    fishes.push_back(FishPtr(new Fish(false,-50,0,0)));
    fishes.push_back(FishPtr(new Fish(false,150,350,1)));
    glutInit(&arg, argv);
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB );
    glutInitWindowSize(w,h);
    glMatrixMode(GL_PROJECTION);
    glutInitWindowPosition(100,200);
    glutCreateWindow("Aquarium v4.0");
 
    glClearColor(0.0,0.0,0.0,1.0);
    glLoadIdentity();
    gluOrtho2D(-w,w,-h,h);
 
    glutDisplayFunc(Draw);
    glutTimerFunc(speed, Timer, 0);
    glutSpecialFunc(SKeyboard);
 
    glutMainLoop();
}


PS:
FPS считаю через виндовую функцию, если в линуксе нужную подставь.
Собственно, у тебя проблемы не глютом, а с C++.
Тоже Windows. Спасибо, принцип работы понял, нас учили пользоваться этими контейнерами, но я не вникал
Проблема теперь, что рыбки не отталкиваются... Это не зависит от того, что у меня main выглядит так:
Кликните здесь для просмотра всего текста
C++
1
2
3
void main(int argc, char **argv)
{
    glutInit(&argc, argv);

?
0
510 / 272 / 60
Регистрация: 14.12.2010
Сообщений: 548
15.06.2013, 22:16 14
Цитата Сообщение от eisenheim Посмотреть сообщение
Проблема теперь, что рыбки не отталкиваются... Это не зависит от того, что у меня main выглядит так:
Кликните здесь для просмотра всего текста
C++
1
2
3
void main(int argc, char **argv)
{
    glutInit(&argc, argv);

?
main я забыл переправить на твой косяк.
Ещё один косяк: строчка 159 должна выглядеть так:
C++
1
for(std::list<FishPtr>::iterator iterSecond = iter; iterSecond != fishes.end(); ++iterSecond)
Коллизии у тебя то происходят то нет.
Для прямоугольников достаточно проверить на нахождение всех точек одного прямоугольника внутри проекций другого прямоугольника.
Для произвольных выпуклых объектов смотри здесь.

Кстати, если тебе просто нужны контейнер объектов Fish, а не указателей, то проще без указателей обойтись, например:

Кликните здесь для просмотра всего текста
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#include <windows.h>
 
#include <glut.h>
//#include <GL\GLAux.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
//#pragma comment (lib, "Glaux.lib")
#pragma comment (lib, "Winmm.lib")
#include <list>
#include <vector>
#include <memory>
#include <iostream>
 
int w = 1000;
int h = 600;
int speed = 1;
int limit = 5;
int counter = 0;
int life = 20000;
 
#define DELTA_MOVE 0.5*10
 
class Fish {
public:
    bool predator;
    float x;
    float y;
    float age;
    float type;
    float r;
    float dX;
    float dY;
    Fish (const Fish& t) {
        predator = t.predator;
        x = t.x;
        y = t.y;
        age = 0;
        type = t.type;
        r = 100.0;
        dX = DELTA_MOVE;
        dY = DELTA_MOVE;
    }
    Fish(bool a, float b, float c, float d) {
        predator = a;
        x = b;
        y = c;
        age = 0;
        type = d;
        r = 100.0;
        rand();
        dX = (((float)rand()/RAND_MAX) > 0.5f? 1 : -1)*DELTA_MOVE;
        dY = (((float)rand()/RAND_MAX) > 0.5f? 1 : -1)*DELTA_MOVE;
    }
 
    void Draw() {
        glTranslatef(x,y,0);
        if(type==0)
            glColor3f(1,1,1);
        else if(type==1)
            glColor3f(0,1,1);
        else
            glColor3f(1,0,0);
        glBegin(GL_QUADS);
            glTexCoord2f(0,1); glVertex2f(0,0); 
            glTexCoord2f(1,1); glVertex2f(100,0);
            glTexCoord2f(1,0); glVertex2f(100,100);
            glTexCoord2f(0,0); glVertex2f(0,100);
        glEnd();
    }
    void Trace()
    {
        age++;
        x+=dX;
        y+=dY;
        
        if(y>=h-100) dY*=-1;
        if(y<=-h) dY*=-1;
        
        if(x>=w-100) dX*=-1;
        if(x<=-w) dX*=-1;
    }
};
 
typedef std::shared_ptr<Fish> FishPtr;
typedef std::list<Fish> FishList;
FishList fishes;
 
void SKeyboard(int key, int x, int y)
{
    int delta = 5;
    switch(key)
    {
        case GLUT_KEY_LEFT:
            speed+=delta;
            break;
        case GLUT_KEY_RIGHT:
            speed-=delta;
            break;
    }
 
    if (speed < 0)
        speed = 0;
}
int fps = 0;
DWORD lastTime = 0;
void Draw()
{
    fps++;
    DWORD time = ::timeGetTime();
    if (time - lastTime > 1000)
    {
        std::cout << "fps: " << fps << std::endl;
        lastTime = time;
        fps = 0;
    }
    glClear(GL_COLOR_BUFFER_BIT);
    for(FishList::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
    {
        Fish& fish = (*iter);
        glPushMatrix();
        fish.Draw();
        glPopMatrix();
    }
    glutSwapBuffers();
    //glFlush();
}
 
void Collision(const Fish& a, const Fish& b) {
    if(a.predator==true && b.predator==false) {
        //ab.del(b);
    }
    if(b.predator==true && a.predator==false) {
        //ab.del(a);
    }
    if(a.predator==false && b.predator==false) {
        //ab.add(new Fish(false,(0),(0),0));
        if(counter<=limit) {
            if ((int)fishes.size()<limit)
                fishes.push_back(Fish(false,a.x - b.x,a.y - b.y,0));
        }
    }
    if(a.predator==true && b.predator==true) {
        //ab.add(new Fish(true,(0),(0),2));
        if(counter<limit) {
            //Fish ttt(false,a.x - b.x,a.y - b.y,0);
            if ((int)fishes.size()<limit)
                fishes.push_back(Fish(false,rand()%1-400,rand()%1-200,0));
        }
    }
}
 
void Timer(int = 0)
{
        for(FishList::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
        {
            Fish& first = (*iter);
            for(FishList::iterator iterSecond = iter; iterSecond != fishes.end(); ++iterSecond)
            {
                if (iter == iterSecond)
                    continue;
                Fish& second = (*iterSecond);
                float a1 = (first.x)-(second.x);
                float a2 = (first.y)-(second.y);
                float a3 = (second.x)-(first.x);
                float a4 = (second.y)-(first.y);
                if((((a1<=102) && (a1>=100)) || ((a3<=102) && (a3>=100))) && (((a2>=0) && (a2<=100)) || ((a4>=0) && (a4<=100)))) {
                    first.dX*=-1;
                    second.dX*=-1;
                    Collision(first,second);
                }
                if((((a2<=100) && (a2>=98)) || ((a4<=100) && (a4>=98))) && (((a1>=0) && (a1<=100)) || ((a3>=0) && (a3<=100)))) {
                    first.dY*=-1;
                    second.dY*=-1;
                    Collision(first,second);
                }
            }
        }
        std::vector<FishList::iterator> remove;
        for(FishList::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
        {
            Fish& first = (*iter);
            first.Trace();
            if(first.age >= life) remove.push_back(iter);
        }
 
        for(std::vector<FishList::iterator>::iterator iter = remove.begin(); iter != remove.end(); ++iter)
        {
            fishes.erase(*iter);
        }
 
        srand(time(NULL));
        glutTimerFunc(speed, Timer, 0);
        glutPostRedisplay();
}
 
void main(int argc, char **argv)
{
    fishes.push_back(Fish(true,-200,100,2));
    fishes.push_back(Fish(false,-50,0,0));
    fishes.push_back(Fish(false,150,350,1));
    glutInit(&arg, argv);
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB );
    glutInitWindowSize(w,h);
    glMatrixMode(GL_PROJECTION);
    glutInitWindowPosition(100,200);
    glutCreateWindow("Aquarium v4.0");
 
    glClearColor(0.0,0.0,0.0,1.0);
    glLoadIdentity();
    gluOrtho2D(-w,w,-h,h);
 
    glutDisplayFunc(Draw);
    glutTimerFunc(speed, Timer, 0);
    glutSpecialFunc(SKeyboard);
 
    glutMainLoop();
}


Добавлено через 19 минут
Поправка: прямоугольники столкнулись, если хотя бы у одной вершины одного прямоугольника все проекции находится внутри всех проекций второго прямоугольника.
Ещё можно окружности(сферы) использовать Тут длина вектора центров, должна быть меньше суммы радиусов для столкновения.
1
18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
16.06.2013, 01:29  [ТС] 15
Цитата Сообщение от EVP Посмотреть сообщение
Поправка: прямоугольники столкнулись, если хотя бы у одной вершины одного прямоугольника все проекции находится внутри всех проекций второго прямоугольника.
Ещё можно окружности(сферы) использовать Тут длина вектора центров, должна быть меньше суммы радиусов для столкновения.
Спасибо за поправки - всё отлично, но теперь столкновения очень странно происходят Т.е. когда должно быть только dX*=-1, оно и dY*=-1 делает, хотя формула осталась та же. Про проекции и вектора, что Вы упомянули выше, я ничего не понял И ещё старые кубики не сталкиваются с новыми (и наоборот), но зато новые с новыми сталкиваются на ура, и не разгоняются
0
510 / 272 / 60
Регистрация: 14.12.2010
Сообщений: 548
16.06.2013, 02:50 16
Цитата Сообщение от eisenheim Посмотреть сообщение
Про проекции и вектора, что Вы упомянули выше, я ничего не понял
Примерно так:
Кликните здесь для просмотра всего текста
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
#include <windows.h>
 
#include <glut.h>
//#include <GL\GLAux.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
//#pragma comment (lib, "Glaux.lib")
#pragma comment (lib, "Winmm.lib")
#include <list>
#include <vector>
#include <memory>
#include <iostream>
 
int w = 1000;
int h = 600;
int speed = 1;
int limit = 8;
int counter = 0;
int life = 20000;
 
#define DELTA_MOVE (0.5f*10)
#define FISH_SIZE 100.f
 
#include <math.h>
class Vector3{
public:
    float x;
    float y;
    float z;
    Vector3(float x = 0.0f, float y = 0.0f, float z = 0.0f)
    {
        this->x = x;
        this->y = y;
        this->z = z;
    }
    
    void set(const Vector3& value)
    {
        x = value.x;
        y = value.y;
        z = value.z;
    }
    
    void set(float x, float y, float z)
    {
        this->x = x;
        this->y = y;
        this->z = z;
    }
    
    Vector3 add(const Vector3& value)const
    {
        return Vector3(x + value.x, y + value.y, z + value.z);
    }
    
    Vector3& add(const Vector3& value, Vector3& dst)const
    {
        Vector3& result = dst;
        float rx = x + value.x;
        float ry = y + value.y;
        float rz = z + value.z;
        result.x = rx;
        result.y = ry;
        result.z = rz;
        return result;
    }
    
    Vector3 sub(Vector3& value)const
    {
        return Vector3(x - value.x, y - value.y, z - value.z);
    }
    
    Vector3& sub(const Vector3& value, Vector3& dst)const
    {
        Vector3& result = dst;
        float rx = x - value.x;
        float ry = y - value.y;
        float rz = z - value.z;
        result.x = rx;
        result.y = ry;
        result.z = rz;
        return result;
    }
    
    Vector3 mul(float scalar)const
    {
        return Vector3(x * scalar, y * scalar, z * scalar);
    }
    
    Vector3& mul(float scalar, Vector3& dst)const
    {
        Vector3& result = dst;
        float rx = x * scalar;
        float ry = y * scalar;
        float rz = z * scalar;
        result.x = rx;
        result.y = ry;
        result.z = rz;
        return result;
    }
    
    float dot(const Vector3& value)const
    {
        float result = x*value.x + y*value.y + z*value.z;
        return result;
    }
    
    Vector3 cros(const Vector3& value)const
    {
        /*
         * ijk
         * xyz
         * XYZ
         */
        return Vector3(y*value.z - z*value.y,
            z*value.x - x*value.z,
            x*value.y - y*value.x);
    }
    
    Vector3& cros(const Vector3& value, Vector3& dst)const
    {
        Vector3& result = dst;
        /*
         * ijk
         * xyz
         * XYZ
         */
        float rx = y*value.z - z*value.y;
        float ry = z*value.x - x*value.z;
        float rz = x*value.y - y*value.x;
        result.x = rx;
        result.y = ry;
        result.z = rz;
        return result;
    }
    
    float length()const
    {
        float result = sqrt(x*x + y*y + z*z);
        return result;
    }
    
    float distance(const Vector3& point)const
    {
        return distance(point.x,point.y,point.z);
    }
    
    float distanceSquared(const Vector3& point)const
    {
        return distanceSquared(point.x,point.y,point.z);
    }
    
    float distance(float x, float y, float z)const
    {
        float result = sqrt(distanceSquared(x,y,z));
        return result;
    }
    
    float distanceSquared(float x, float y, float z)const
    {
        float dx = x - this->x;
        float dy = y - this->y;
        float dz = z - this->z;
        float result = dx*dx + dy*dy + dz*dz;
        return result;
    }
    
    float angle(const Vector3& vector)
    {
        float dot = this->dot(vector);
        float thisLength = length();
        float vectorLength = vector.length();
        float cosAngle = dot / (thisLength * vectorLength);
        if (cosAngle > 1)
            cosAngle = 1;
        else if (cosAngle < -1)
            cosAngle = -1;
        float angle = (float)acos(cosAngle);
        return angle;
    }
};
 
#include <algorithm>
#undef min
#undef max
 
class Box{
public:
    Vector3 position;
    float length;   //on x
    float width;        //on y
    float height;   //on z
 
    Box(const Vector3& one, const Vector3& two)
    {
        set(one, two);
    }
    
    Box(float x = 0, float y = 0, float z = 0, float length = 0, float width = 0, float height = 0)
    {
        set(x,y,z,length,width,height);
    }
    
    void set(const Vector3& one, const Vector3& two)
    {
        position.x = std::min(one.x, two.x);
        position.y = std::min(one.y, two.y);
        position.z = std::min(one.z, two.z);
        length = (float)abs(one.x - two.x);
        width = (float)abs(one.y - two.y);
        height = (float)abs(one.z - two.z);
    }
    
    void set(float x, float y, float z, float length, float width, float height)
    {
        this->position.x = x;
        this->position.y = y;
        this->position.z = z;
        this->length = length;
        this->width = width;
        this->height = height;
    }
    
    bool isOverlaped(const Box& box)const;
    bool contains(const Vector3& point)const;
    bool contains(float x, float y, float z)const;
};
 
class OverlapTester
{
public:
    static bool isOverlaped(const Box& box1, const Box& box2);
    static bool isPointInBox(const Box& box, const Vector3& point);
    static bool isPointInBox(const Box& box, float x, float y, float z);
};
 
 
bool Box::isOverlaped(const Box& box)const
{
    return OverlapTester::isOverlaped(*this, box);
}
    
bool Box::contains(const Vector3& point)const
{
    return OverlapTester::isPointInBox(*this, point);
}
    
bool Box::contains(float x, float y, float z)const
{
    return OverlapTester::isPointInBox(*this, x, y, z);
}
    
bool OverlapTester::isOverlaped(const Box& box1, const Box& box2)
{
    return (box1.position.x < box2.position.x + box2.length &&
        box1.position.x + box1.length > box2.position.x &&
        box1.position.y < box2.position.y + box2.width &&
        box1.position.y + box1.width > box2.position.y &&
        box1.position.z < box2.position.z + box2.height &&
        box1.position.z + box1.height > box2.position.z);
}
    
bool OverlapTester::isPointInBox(const Box& box, const Vector3& point)
{
    return box.position.x <= point.x && box.position.x + box.length >= point.x &&
            box.position.y <= point.y && box.position.y + box.width >= point.y &&
            box.position.z <= point.z && box.position.z + box.height >= point.z;
}
    
bool OverlapTester::isPointInBox(const Box& box, float x, float y, float z)
{
    return box.position.x <= x && box.position.x + box.length >= x &&
        box.position.y <= y && box.position.y + box.width >= y &&
        box.position.z <= z && box.position.z + box.height >= z;
}
 
 
class Fish {
public:
    bool predator;
    Box body;
    float age;
    float type;
    Vector3 speed;
    Vector3 impulseSpeed;
    Fish (const Fish& t) {
        predator = t.predator;
        body = t.body;
        age = 0;
        type = t.type;
        speed.set(DELTA_MOVE,DELTA_MOVE,0);
    }
    Fish(bool _predator, float x, float y, float _type) {
        predator = _predator;
        body.position.set(x,y,0);
        body.length = body.width = FISH_SIZE;
        body.height = 1;
        age = 0;
        type = _type;
        rand();
        speed.set((((float)rand()/RAND_MAX) > 0.5f? 1 : -1)*DELTA_MOVE,
            (((float)rand()/RAND_MAX) > 0.5f? 1 : -1)*DELTA_MOVE, 0);
    }
 
    void Draw() {
        glTranslatef(body.position.x,body.position.y,0);
        if(type==0)
            glColor3f(1,1,1);
        else if(type==1)
            glColor3f(0,1,1);
        else
            glColor3f(1,0,0);
        glBegin(GL_QUADS);
            glTexCoord2f(0,1); glVertex2f(0,0); 
            glTexCoord2f(1,1); glVertex2f(FISH_SIZE,0);
            glTexCoord2f(1,0); glVertex2f(FISH_SIZE,FISH_SIZE);
            glTexCoord2f(0,0); glVertex2f(0,FISH_SIZE);
        glEnd();
    }
    void Trace()
    {
        age++;
        if (abs(impulseSpeed.length()) > 0.1)
        {
            speed.set(impulseSpeed);
            impulseSpeed.set(0,0,0);
        }
        body.position.add(speed, body.position);
    }
};
 
typedef std::list<Fish> FishList;
FishList fishes;
Box screenBody;
 
void SKeyboard(int key, int x, int y)
{
    int delta = 5;
    switch(key)
    {
        case GLUT_KEY_LEFT:
            speed+=delta;
            break;
        case GLUT_KEY_RIGHT:
            speed-=delta;
            break;
    }
 
    if (speed < 0)
        speed = 0;
}
int fps = 0;
DWORD lastTime = 0;
void Draw()
{
    fps++;
    DWORD time = ::timeGetTime();
    if (time - lastTime > 1000)
    {
        std::cout << "fps: " << fps << std::endl;
        lastTime = time;
        fps = 0;
    }
    glClear(GL_COLOR_BUFFER_BIT);
    for(FishList::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
    {
        Fish& fish = (*iter);
        glPushMatrix();
        fish.Draw();
        glPopMatrix();
    }
    glutSwapBuffers();
    //glFlush();
}
 
void Collision(const Fish& a, const Fish& b) {
    if(a.predator==true && b.predator==false) {
        //ab.del(b);
    }
    if(b.predator==true && a.predator==false) {
        //ab.del(a);
    }
    if(a.predator==false && b.predator==false) {
        //ab.add(new Fish(false,(0),(0),0));
        if(counter<=limit) {
            if ((int)fishes.size()<limit)
                fishes.push_back(Fish(false,a.body.position.x - b.body.position.x,
                    a.body.position.y - b.body.position.y,0));
        }
    }
    if(a.predator==true && b.predator==true) {
        //ab.add(new Fish(true,(0),(0),2));
        if(counter<limit) {
            //Fish ttt(false,a.x - b.x,a.y - b.y,0);
            if ((int)fishes.size()<limit)
                fishes.push_back(Fish(true,rand()%1-400,rand()%1-200,0));
        }
    }
}
 
void Timer(int = 0)
{
        for(FishList::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
        {
            Fish& first = (*iter);
            for(FishList::iterator iterSecond = iter; iterSecond != fishes.end(); ++iterSecond)
            {
                if (iter == iterSecond)
                    continue;
                Fish& second = (*iterSecond);
                if (first.body.isOverlaped(second.body))
                {
                    Vector3 dir = first.body.position.sub(second.body.position);
                    float dirLength = dir.length();
                    if (abs(dirLength) < 0.1f)
                        dir.set(1,1,0);
                    dir.mul(DELTA_MOVE/dir.length(), dir);
                    first.impulseSpeed.add(dir, first.impulseSpeed);
                    dir.mul(-1,dir);
                    second.impulseSpeed.add(dir, second.impulseSpeed);
                    Collision(first,second);
                }
            }
            if (!first.body.isOverlaped(screenBody))
            {
                Vector3 dir(screenBody.position.x + screenBody.length/2,
                    screenBody.position.y + screenBody.width/2, 0);
                dir.sub(first.body.position, dir);
                dir.mul(DELTA_MOVE/dir.length(), dir);
                first.impulseSpeed.add(dir, first.impulseSpeed);
            }
        }
        std::vector<FishList::iterator> remove;
        for(FishList::iterator iter = fishes.begin(); iter != fishes.end(); ++iter)
        {
            Fish& first = (*iter);
            first.Trace();
            if(first.age >= life) remove.push_back(iter);
        }
 
        for(std::vector<FishList::iterator>::iterator iter = remove.begin(); iter != remove.end(); ++iter)
        {
            fishes.erase(*iter);
        }
 
        srand(time(NULL));
        glutTimerFunc(speed, Timer, 0);
        glutPostRedisplay();
}
 
void main(int argc, char **argv)
{
    fishes.push_back(Fish(true,-200,100,2));
    fishes.push_back(Fish(false,-50,0,0));
    fishes.push_back(Fish(false,150,350,1));
    glutInit(&arg, argv);
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB );
    glutInitWindowSize(w,h);
    glMatrixMode(GL_PROJECTION);
    glutInitWindowPosition(100,200);
    glutCreateWindow("Aquarium v4.0");
 
    glClearColor(0.0,0.0,0.0,1.0);
    glLoadIdentity();
    gluOrtho2D(-w,w,-h,h);
    screenBody.set(-w+FISH_SIZE,-h+FISH_SIZE,-10, w*2-2*FISH_SIZE, h*2-2*FISH_SIZE, 20);
 
    glutDisplayFunc(Draw);
    glutTimerFunc(speed, Timer, 0);
    glutSpecialFunc(SKeyboard);
 
    glutMainLoop();
}
1
18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
16.06.2013, 12:04  [ТС] 17
Цитата Сообщение от EVP Посмотреть сообщение
Примерно так
Тут получается, что рыбки константных размеров, 100х100, а они у меня будут разных размеров, в зависимости от их type.
0
510 / 272 / 60
Регистрация: 14.12.2010
Сообщений: 548
16.06.2013, 12:32 18
Цитата Сообщение от eisenheim Посмотреть сообщение
Тут получается, что рыбки константных размеров, 100х100, а они у меня будут разных размеров, в зависимости от их type.
Там body может быть любых размеров, установи нужный
В любом случае это пример, а не готовая реализация..
1
18 / 8 / 2
Регистрация: 06.06.2011
Сообщений: 268
16.06.2013, 12:41  [ТС] 19
Но зато теперь они лучше отбиваются, более реалистично, но вот оттолкнувшись от стенки, они отлетают не в другую сторону, под определённым углом, а просто летят назад.
0
510 / 272 / 60
Регистрация: 14.12.2010
Сообщений: 548
16.06.2013, 13:55 20
я их просто сталкивал интенсивнее, но поведение можно изменить, если заменить строчки 427-431 на эти:

Кликните здесь для просмотра всего текста
C++
1
2
3
4
5
6
7
8
                if (first.body.position.x > (screenBody.position.x + screenBody.length) && first.speed.x > 0)
                    first.speed.x *= -1;
                if (first.body.position.x < screenBody.position.x && first.speed.x < 0)
                    first.speed.x *= -1;
                if (first.body.position.y > (screenBody.position.y + screenBody.width) && first.speed.y > 0)
                    first.speed.y *= -1;
                if (first.body.position.y < screenBody.position.y && first.speed.y < 0)
                    first.speed.y *= -1;


Удачи с Аквариумом
1
16.06.2013, 13:55
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
16.06.2013, 13:55
Помогаю со студенческими работами здесь

тиц не растет
а можно ли как-нибудь узнать почеум у сайта не растет тиц? b-(

ТИЦ не растет
Тут была похожая тема, но ее закрыли, правда у меня другой вопрос: Мой форум...

Растет пинг
Приветствую. Есть компьютер, ноутбук, NAS, роутер(TL-WR841N/TL-WR841ND) и вафельный...

Змейка не растет
Вообщем решил я как и все написать змейку консольную, но вот проблема, не растет скотина :) ...

Помогите опознать диодный мост таймера духовки Hansa BOEM 624000, диодный мост таймера
Помогите опознать диодный мост таймера духовки Hansa BOEM 624000 мост смд маленький примерно...

Почему не растет ТИЦ И PR?
Есть каталог сайтов, при регистрации в котором пользователи размещают на своих сайтов кнопку 88x31...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
20
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru