take below code and run it, I need to draw to a image and then check it for collisions, drawing to it is no problem, if you COMMENT OUT ""totalt = ImagesCollide (mouseIMG, mxnew,mynew,0,playfieldIMG,0,0,0)"" in the program, (use mouse to draw) you will see that drawing is fine, and happens fast, draw to imagebuffer, and display it. Simple, now turn on imagescollide and it slows and interrupts big time. Its not that imagescollide is slow at all, because when you arn't drawing and just moving the mouse around, it collides fast, and detects, ect. it only crawls when you try to Draw to ImageBuffer, and then after check it with imagescollide. like its not releasing it fast enough for imagescollide to do its work or something, Why, even using lockbuffers, doesn't help.
Any way to get this to work right, maybe poke/peek to a bank? i dunno, just need to draw and check for collisions at the same time. (well checking while drawing)
Any way to get this to work right, maybe poke/peek to a bank? i dunno, just need to draw and check for collisions at the same time. (well checking while drawing)
Const xres = 800 Const yres = 600 Graphics xres,yres,16, 1 Global mouseIMG, playfieldIMG, mxold,myold,mxnew,mynew mouseIMG = CreateImage(16,16) playfieldIMG = CreateImage(xres,yres) SetBuffer ImageBuffer(mouseIMG) Rect 0,0,16,16,1 SetBuffer BackBuffer() Repeat mxold = mxnew myold = mynew mxnew = MouseX() mynew = MouseY() If MouseDown(1) Then LockBuffer ImageBuffer(playfieldIMG) WritePixelFast mxnew-16,mynew-16, $05FF05, ImageBuffer(playfieldIMG) UnlockBuffer ImageBuffer(playfieldIMG) ;SetBuffer ImageBuffer(playfieldIMG) ;Line mxold-16, myold-16, mxnew-16,mynew-16 ;SetBuffer BackBuffer() End If totalt = ImagesCollide (mouseIMG, mxnew,mynew,0,playfieldIMG,0,0,0) DrawBlock playfieldIMG,0,0 DrawImage mouseIMG, MouseX(),MouseY() Text 10,10,totalt Flip True Cls Until KeyHit(1)