Pic.Rotate
Author |
Message |
david92ng
|
Posted: Thu Apr 10, 2008 11:24 am Post subject: Pic.Rotate |
|
|
When I rotate a picture, I get this error after about... 30 seconds. "Cannot allocate item. Out of id numbers (Max 1000)."
This is part of the program i made that uses it. It is my first time i used Pic.Rotate and have no idea how to fix or it means.
setscreen ("Graphics:1000;800")
var chars : array char of boolean
%========================
var ship : int
var currentship : int
var angle : int := 1
ship := Pic.FileNew ("test.bmp")
%========================
var x, y : int := 1
var xmove, ymove : int := 0
loop
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) then
ymove += 1
end if
if chars (KEY_RIGHT_ARROW) then
angle += 2
xmove += 1
end if
if chars (KEY_LEFT_ARROW) then
angle -= 2
xmove -= 1
end if
if chars (KEY_DOWN_ARROW) then
ymove -= 1
end if
if ymove > 3 then
ymove := 2
elsif ymove < -3 then
ymove := -2
end if
if xmove > 3 then
xmove := 2
elsif xmove < -3 then
xmove := -2
end if
x := x + xmove
y := y + ymove
if angle > 360 then
angle := (angle - 360)
end if
if angle < 0 then
angle := (angle + 360)
end if
currentship := Pic.Rotate (ship, angle, -1, -1)
put x, " ", y, " ", angle
Pic.Draw (currentship, x, y, picCopy)
View.Update
delay (100)
cls
end loop |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Nick
![](http://compsci.ca/v3/uploads/user_avatars/19644337547e837b41d67a.png)
|
Posted: Thu Apr 10, 2008 2:11 pm Post subject: RE:Pic.Rotate |
|
|
pic.free ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
andrew.
|
Posted: Thu Apr 10, 2008 4:34 pm Post subject: Re: Pic.Rotate |
|
|
Turing only allows you to have a max of 1000 things. To get around this, you have to "free" the picture with Pic.Free like nick said. |
|
|
|
|
![](images/spacer.gif) |
|
|