Форум по Delphi программированию

Delphi Sources



Вернуться   Форум по Delphi программированию > Все о Delphi > Мультимедиа
Ник
Пароль
Регистрация <<         Правила форума         >> FAQ Пользователи Календарь Поиск Сообщения за сегодня Все разделы прочитаны

Ответ
 
Опции темы Поиск в этой теме Опции просмотра
  #1  
Старый 22.03.2014, 19:23
ThierryH ThierryH вне форума
Прохожий
 
Регистрация: 22.03.2014
Сообщения: 2
Версия Delphi: Delphi7
Репутация: 10
Восклицание bitmap -incompetible types

Добрый день, очень прошу помощи.
Подскажите,пож-та,
сразу покажу мой код:
Код:
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
uses
  Classes, SysUtils, Graphics;
 
type
 
    { TBase }
 
    TBase=class
       private
         x: Integer;
         y: Integer;
       public
         constructor Create(x0, y0: Integer);
         procedure setX (x0: Integer);
         procedure setY (y0: Integer);
         function  getX: Integer;
         function  getY: Integer;
    end;
 
    { TStatic }
 
    TStatic=class(TBase)
      private
        bitmap: TBitmap;
      public
        constructor Create(x0, y0: Integer; bitmap0: TBitmap);
        procedure setBitmap (bitmap0: TBitmap);
        function getBitmap: TBitmap;
    end;
 
    { TAnimate }
 
    TAnimate=class(TBase)
      private
         bitmap: array[0..100] of TBitmap;
         curFrame: Integer;
         maxFrame: Integer;
      public
        constructor Create(x0, y0: Integer; bitmap0: array of TBitmap;
          maxFrame0: Integer);
        procedure nextFrame;
        procedure setBitmap(bitmap0: array of TBitmap);
        function getCurFrame: Integer;
        function getMaxFrame: Integer;
        function getBitmap:TBitmap;
    end;
 
 
{ TAnimate }
 
constructor TAnimate.Create(x0, y0: Integer; bitmap0: array of TBitmap;
  maxFrame0: Integer);
begin
  x:=x0;
  y:=y0;
  bitmap:=bitmap0;
  curFrame:= 0;
  maxFRame:= maxFrame0;
end;
 
procedure TAnimate.nextFrame;
begin
  if curFrame < maxFrame then
     curFrame:=curFrame+1
  else
      curFrame:=0;
end;
 
procedure TAnimate.setBitmap(bitmap0: array of TBitmap);
begin
  bitmap:=bitmap0;
end;
 
function TAnimate.getCurFrame: Integer;
begin
  result:= curFrame;
end;
 
function TAnimate.getMaxFrame: Integer;
begin
  result:= maxFrame;
end;
 
function TAnimate.getBitmap: TBitmap;
begin
  result:=bitmap[curFrame];
end;
 
{ TStatic }
 
constructor TStatic.Create(x0, y0: Integer; bitmap0: TBitmap);
begin
  x:=x0;
  y:=y0;
  bitmap:=bitmap0;
end;
 
procedure TStatic.setBitmap(bitmap0: TBitmap);
begin
  bitmap:=bitmap0;
end;
 
function TStatic.getBitmap: TBitmap;
begin
  result:=bitmap;
end;
 
{ TBase }
 
constructor TBase.Create(x0, y0: Integer);
begin
  x:=x0;
  y:=y0;
end;
 
procedure TBase.setX(x0: Integer);
begin
  x:=x0;
end;
 
procedure TBase.setY(y0: Integer);
begin
  y:=y0;
end;
 
function TBase.getX: Integer;
begin
  result:=x;
end;
 
function TBase.getY: Integer;
begin
  result:=y;
end;
 
end.
Админ: Пользуемся тегами для оформления кода!

Выдает ошибку Incompetible Types в:
constructor TAnimate.Create(x0, y0: Integer; bitmap0: array of TBitmap;
maxFrame0: Integer);
begin
bitmap:=bitmap0; //вот в этом месте ошибка

Очень-очень сильно прошу помочь.
Видел в интернете описание с подобной ошибкой и пути решения, но так и не смог ее исправить.
Прошу подробного кода на данном примере

Последний раз редактировалось Admin, 22.03.2014 в 19:30.
Ответить с цитированием
  #2  
Старый 22.03.2014, 20:31
lmikle lmikle вне форума
Модератор
 
Регистрация: 17.04.2008
Сообщения: 8,094
Версия Delphi: 7, XE3, 10.2
Репутация: 49089
По умолчанию

Try this:

Код:
1
2
3
4
5
6
7
8
9
10
11
12
13
constructor TAnimate.Create(x0, y0: Integer; bitmap0: array of TBitmap;
  maxFrame0: Integer);
var
  I : Integer;
begin
  x:=x0;
  y:=y0;
  SetLength(bitmap,Length(bitmap0));
  For I := Low(bitmap0) to High(bitmap0) Do
    bitmap[i] := bitmap0[i];
  curFrame:= 0;
  maxFRame:= maxFrame0;
end;
Ответить с цитированием
Ответ


Delphi Sources

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB-коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход


Часовой пояс GMT +3, время: 17:06.


 

Сайт

Форум

FAQ

Соглашения

Прочее

 

Copyright © Форум "Delphi Sources" by BrokenByte Software, 2004-2025