LB Booster
« The first off screen capture/sprite animate »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:37am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: The first off screen capture/sprite animate  (Read 337 times)
michael
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx The first off screen capture/sprite animate
« Thread started on: Mar 23rd, 2016, 9:27pm »

I present my off screen image capture for flicker free animation... (its actually an old post that I reposted here in case a moderator decides to check here..

This example should work.. But some older windows/computers don't allow offscreen draws.
Code:
'CURRENTLY THERE ARE 2 SPRITE READY COMMANDS.. circle and gline LOOK AT BASE OF PROGRAM
global gcolor$
call screen 1200,800 ' THIS COMMAND WILL SET UP SCREEN AND OFFSET WINDOW

' OK now that the images are captured lets place them on a refreshed cycle ********
' YOUR GRAPHICS UPDATES IN MASK AREA START HERE
[loop]
for l=1 to 200
call refresh
gcolor$="green"' a global variable for a line command
'call gline 100,100,200,200  ' optional line command
scan
call circle 200,200,l ' THIS IS A CUSTOM SPRITE READY CIRCLE


'  YOUR GRAPHICS DRAWS MUST END HERE *******************************
call display  ' THIS COMMAND OUTPUTS YOUR SLIDE SHOW IMAGE TO SCREEN
next l ' IN THIS CASE I MADE A CIRCLE THAT CYCLES TO SIZE 200
goto [loop]
wait
[quit]
UNLOADBMP "bl"
UNLOADBMP "wh"
'UNLOADBMP "sh"
close #h
end
'********************** SUB TOOLS BELLOW HERE ***************************
sub display
#h.1 "getbmp dis 0 0 399 799"
#h.2 "addsprite dis1 dis"
#h.2 "drawsprites"
end sub
sub refresh' makes new slate for draws in the prep area
#h.1 "cls"
#h.1 "drawbmp wh 0 0"
#h.1 "drawbmp bl 0 400"
end sub

sub screen x,y' prepares the graphic boxes and host window
nomainwin
WindowWidth=x
WindowHeight=y
UpperLeftX=0
UpperLeftY=0
global getsizeh' globals have been moved to make it a cleaner interface
global getsizev
global hpos ' the horizontal locators for ENTER sub
global vpos ' the vertical locator for ENTER sub
global gcolor$   ' YOU MUST DEFINE gcolor$ BEFORE you use GRPRINT or ENTER but it only needs to be done once

graphicbox #h.1, 1,1,401,801 'create the capture area
graphicbox #h.2, 401,1,801,801' create the display screen
open "Generic Window Host" for window_nf as #h
print #h, "trapclose [quit]"
    hWindow = hwnd(#h)
    calldll #user32, "MoveWindow",_
        hWindow as ulong,_
        -403 as long,_
        10 as long,_
        x as long,_
        y as long,_
        1 as long,_
        result as long
#h.1 "down;fill black"
#h.1 "getbmp bl 0 0 399 399"
#h.1 "down;fill white"
#h.1 "getbmp wh 0 0 399 399"
#h.2 "down;fill black"
end sub
'**************GLINE **************************
sub gline x,y,h,v
#h.1 "down;color black;line ";x;" ";y;" ";h;" ";v
#h.1 "color ";gcolor$;";line ";x;" ";y+400;" ";h;" ";v+400
end sub
'**************CIRCLE*************************
sub circle x,y,size
#h.1 "down;color black;place ";x;" ";y;";circle ";size
#h.1 "color ";gcolor$;";place ";x;" ";y+400;";circle ";size
end sub
 

  
User IP Logged

I make program generators and some utilities. Its my hobby
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls