Форум: "Игры";
Текущий архив: 2005.03.20;
Скачать: [xml.tar.bz2];
ВнизДинамическое создание объектов в glscene Найти похожие ветки
← →
Goldseeker (2004-12-24 21:01) [0]почему этот код не работает, причем дает ошибку лишь при повторном нажатии кнопки:
procedure TForm1.Button1Click(Sender: TObject);
begin
setlength(sphere,length(sphere)+1);
sphere[length(sphere)]:=msphere(gldummycube1.AddNewChild(msphere)) ;
sphere[length(sphere)].Position.x:=random(2);
sphere[length(sphere)].Position.y:=random(2);
sphere[length(sphere)].Position.z:=random(2);
end;
sphere - динамический массив msphere
msphere - класс потомок tglsphere
← →
kerby (2004-12-27 09:39) [1]паскальчик учить надо
переменные:
sphere:array of tglsphere;
count:integer;
инициализация:
count:=0;
setlength(sphere,count);
обработчик:
inc(count);
SetLength(sphere,count);
sphere[count-1]:=TGLSphere(GLDummyCube1.AddNewChild(TGLSphere));
^^^^^^^^
with sphere[count-1] do
^^^^^^^^
begin
Position.SetPoint(random(5),random(5),random(5));
end;
Страницы: 1 вся ветка
Форум: "Игры";
Текущий архив: 2005.03.20;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.038 c