Posted: 28th Jun 2007 8:32
is something wrong with my paste image code?

im trying to make a GUI with it...


+ Code Snippet
Load DLL   "user32.dll",1
        DisplayX = Call DLL( 1 , "GetSystemMetrics" , 0 )
        DisplayY = Call DLL( 1 , "GetSystemMetrics" , 1 )
Delete DLL 1

sync on : sync rate 60

if check display mode(1280,1024,32)=1 THEN set display mode 1280,1024,32
load image "menu1.png",1
for x=0 to 10 : for y=0 to 10
paste image 1,x*1280,y*1024,1
next y : next x
wait mouse
Posted: 28th Jun 2007 8:38
Fixed it, added Sync before next

Edit: Code for anyone who would like to use it. might not help much though

+ Code Snippet
Load DLL   "user32.dll",1
        DisplayX = Call DLL( 1 , "GetSystemMetrics" , 0 )
        DisplayY = Call DLL( 1 , "GetSystemMetrics" , 1 )
Delete DLL 1

sync on : sync rate 60

if check display mode(1280,1024,32)=1 THEN set display mode 1280,1024,32
load image "menu1.png",1
for x=0 to 10 : for y=0 to 10
paste image 1,x*1280,y*1024,1
sync
next y : next x
wait mouse
Posted: 28th Jun 2007 8:59
Shouldn't the Sync be outside of the for/next loops ?

ie.
+ Code Snippet
Load DLL   "user32.dll",1
        DisplayX = Call DLL( 1 , "GetSystemMetrics" , 0 )
        DisplayY = Call DLL( 1 , "GetSystemMetrics" , 1 )
Delete DLL 1

sync on : sync rate 60

if check display mode(1280,1024,32)=1 THEN set display mode 1280,1024,32
load image "menu1.png",1
for x=0 to 10 : for y=0 to 10
paste image 1,x*1280,y*1024,1
next y : next x

sync   
wait mouse

Posted: 28th Jun 2007 10:52
well i guess it works with both?
Posted: 28th Jun 2007 11:26
Yes it works in both ways, although if the sync is placed within the for/next loop, it will be a lot slower as it has to refresh the screen every iteration.

Additionally, in Kevin Picone's code, since the sync is not placed in a loop, you have to call it twice in order to display the image.

+ Code Snippet
Load DLL   "user32.dll",1
        DisplayX = Call DLL( 1 , "GetSystemMetrics" , 0 )
        DisplayY = Call DLL( 1 , "GetSystemMetrics" , 1 )
Delete DLL 1

sync on : sync rate 60

if check display mode(1280,1024,32)=1 THEN set display mode 1280,1024,32
load image "menu1.png",1
for x=0 to 10 : for y=0 to 10
paste image 1,x*1280,y*1024,1
next y : next x

sync:sync   
wait mouse

Posted: 28th Jun 2007 11:43
Dont know if this is the right way round but, I'd put the Sync Rate & Sync On commands after the Set Display Mode...
Also, I noticed that the paste command, pastes the image up to 10 times the screen dimention X&Y ? why ? you will only see the first paste.

+ Code Snippet
Load Dll "User32.dll",1
  DisplayX = Call Dll(1,"GetSystemMetrics",0)
  DisplayY = Call Dll(1,"GetSystemMetrics",1)
Delete Dll 1
If Check Display Mode (1280,1024,32)
  Set Display Mode 1280,1024,32
  Sync Rate 60 : Sync On : Sync
  Load Image " Menu1.Png",1
  For X = 0 to 10
    For Y = 0 to 10
      `Your Paste Command...
      Paste Image 1, X*1280,Y*1024,1
      `Fake 3D Paste...
      `Paste Image 1,X,Y,1
      `Tile Paste...
      `Paste Image 1,X*Image Width(1),Y*Image Height(1),1
    Next Y
  Next X
  Sync
EndIf
Wait Mouse
End


Incidentaly, the Sync command has to be called once to initiate the display backbuffer, then it has to be called once for every refresh or screen update.
Posted: 28th Jun 2007 12:00
Well, in this situation the location of the sync command isn't really important. He needs to make a proper Do...Loop and use a Sync before the Loop.