
-----------------------------------
david92ng
Thu Apr 10, 2008 11:24 am

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

-----------------------------------
Nick
Thu Apr 10, 2008 2:11 pm

RE:Pic.Rotate
-----------------------------------
pic.free ;)

-----------------------------------
andrew.
Thu Apr 10, 2008 4:34 pm

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.
