Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Screenshot not working
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
SNIPERDUDE




PostPosted: Thu Jun 07, 2007 11:43 am   Post subject: Screenshot not working

I am making a isometric tile based game, and I have the drawing of the map working.
But when I save the screenshot of the map, when I call the map to draw it an error appears saying the image was probably does not exist.

This only seems to happen when I make my map larger than 14 * 14 (each tile is about 66 * 33 px)

The reason I am trying to do this is so I can just call a screenshot to prevent lag when drawing the map

How can I avoid or fix this error?
Sponsor
Sponsor
Sponsor
sponsor
DIIST




PostPosted: Thu Jun 07, 2007 10:26 pm   Post subject: Re: Screenshot not working

Could you please post a sample of the code involving the problem. By the looks of it it seems you are having trouble with the pic module. Possible common reasons could be:

--You are not Pic Freeing and instead adding more resources each frame..
--You have several large images already loading and turing dosn't have enough space to create another image.

Anyway the exact error cant be known until you most a piece of the code. Wink
SNIPERDUDE




PostPosted: Fri Jun 08, 2007 1:00 pm   Post subject: Re: Screenshot not working

Yea, here's the code. sorry I didn't comment, just ask if you need anything cleared up.
Oh yea, the first proc is to get the tiles from a tilemap.

code:

setscreen ("nobuttonbar, offscreenonly,graphics:max;max")

var TileSprite : int := Pic.FileNew ("tiles.bmp")
Pic.Draw (TileSprite, 0, 0, 0)
var Map, mx, my, mb : int
var Tiles : array 1 .. 40 of int
var Grid : array 1 .. 100, 1 .. 100 of int
var strLine : array 1 .. 100 of string
var key : array char of boolean
var file, maxD : int
var n, k, t : int := 1
var scrollX, scrollY : int := 0
var Ex : boolean := false

proc ReadTiles
    for j : 0 .. 9
        for i : 1 .. 4
            Tiles ((j * 4) + i) := Pic.New (((i - 1) * 65) + 1, (j * 33) + 1, ((i - 1) * 65) + 64, (j * 33) + 32)
        end for
    end for
end ReadTiles

proc ReadMap
    open : file, "testmap.txt", get
    get : file, maxD
    for j : 1 .. maxD
        get : file, strLine (j)
    end for
    close : file

    t := maxD
    loop
        exit when n > maxD
        loop
            exit when k > 3 * maxD
            if strLine (n) (k) = "|" then;
                Grid (n, t) := strint (strLine (n) (k + 1) + strLine (n) (k + 2));
                t -= 1;
            end if
            k += 1
        end loop
        n += 1
        k := 1
        t := maxD
    end loop
end ReadMap

proc DrawMap
    drawfillbox (0, 0, maxx, maxy, 7)
    for j : 1 .. maxD
        for i : 1 .. maxD
            Pic.Draw (Tiles (Grid (i, j)), (maxx div 2) - 33 + (i * 33) - ((j - 1) * 33) + scrollX, ((maxy div 2) + (maxD * 16)) - (i * 16) - ((j - 1) * 16) + scrollY, picMerge)
        end for
    end for
    Map := Pic.New ((maxx div 2) - (maxD * 33) + 32, (maxy div 2) - (maxD * 16) + 16, (maxx div 2) + (maxD * 33) + 31, (maxy div 2) + (maxD * 16) + 16)
end DrawMap

proc Walk
    Input.KeyDown (key)
    Mouse.Where (mx, my, mb)
   
    if my > maxy - 30 then
        scrollY -= 5
    end if
    if my < 30 then
        scrollY += 5
    end if
    if mx > maxx - 30 then
        scrollX -= 5
    end if
    if mx < 30 then
        scrollX += 5
    end if
    if key (KEY_ESC) then
        Ex := true
    end if
end Walk

ReadTiles
ReadMap
DrawMap
loop
    Walk
    drawfillbox (0, 0, maxx, maxy, 7)
    Pic.Draw (Map, (maxx div 2) - (Pic.Width (Map) div 2) + scrollX, (maxy div 2) - (Pic.Height (Map) div 2) + scrollY, 0)
    View.Update
    exit when Ex = true
    delay (10)
end loop
SNIPERDUDE




PostPosted: Wed Jun 13, 2007 11:51 am   Post subject: Re: Screenshot not working

Why won't anyone help me?

so alone... Sad
SNIPERDUDE




PostPosted: Wed Jul 04, 2007 11:37 am   Post subject: Re: Screenshot not working

hello? Anyone?
McKenzie




PostPosted: Wed Jul 04, 2007 12:14 pm   Post subject: Re: Screenshot not working

Well Dude,

1. It's summertime so everyone's out having fun.
2. You did not attach tiles.bmp and testmap.txt.
Mazer




PostPosted: Wed Jul 04, 2007 12:21 pm   Post subject: RE:Screenshot not working

You're probably getting values outside of the window boundaries when you're calling Pic.New, and Turing probably doesn't like that.

You know, you could've just pasted that Pic.New line, or even pointed out that it was the relevant line. It's very likely that nobody replied because nobody cared to wade through the rest of that.
SNIPERDUDE




PostPosted: Tue Jul 10, 2007 9:42 pm   Post subject: Re: Screenshot not working

I know people don't like reading that much (I blame the lazy society that has become of us because of technology), but it is the only way one can fully understand my problem.

And no, it is not reading past the max coordinates. My guess is that turing just doesn't have that much memory.
I am going to try another method (saving mini pics and just tile them together)

Let me know if anyone has come up with a better solution
Sponsor
Sponsor
Sponsor
sponsor
CodeMonkey2000




PostPosted: Wed Jul 11, 2007 2:12 pm   Post subject: RE:Screenshot not working

You know it would really helpful if you included the txt file and the images.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: