[fpc-pascal] Incompatible types: got "Extended" expected "SmallInt"
David Emerson
dle3ab at angelbase.com
Fri Mar 27 07:38:40 CET 2009
because the '/' operator does not return an integer. Use div if you want
an integer result.
Cheers,
David.
On Thu 26 Mar 2009, Joseph Montanez wrote:
> Im not sure why its giving me this error, as its pointing right at the
> plus signs
>
> G3DPrimatives.pas(34,43) Error: Incompatible types: got "Extended"
> expected "SmallInt"
> G3DPrimatives.pas(36,43) Error: Incompatible types: got "Extended"
> expected "SmallInt"
>
> 2 : Index := Y * Surface^.pitch / 2 + X;
> ^
> 23 procedure DrawPixel(var Surface : PSDL_Surface; X, Y, R, G, B :
integer);
> 24 var
> 25 Color : longword;
> 26 Pixel : ^longword;
> 27 Index : integer;
> 28 begin
> 29 New(Pixel);
> 30 case Surface^.format^.BytesPerPixel of
> 31 {8bpp}
> 32 1 : Index := Y * Surface^.pitch + X;
> 33 {16bpp}
> 34 2 : Index := Y * Surface^.pitch / 2 + X;
> 35 {32bpp}
> 36 4 : Index := Y * Surface^.pitch / 4 + X;
> 37 else
> 38 WriteLn('Unsupported byte per pixel');
> 39 end;
> 40 Pixel := Surface^.pixels + Index;
> 41 Color := SDL_MapRGB(Surface^.format, R, G, B);
> 42 Pixel^:= Color;
> 43 end;
> __________________________
More information about the fpc-pascal
mailing list