IndexBase 0
Include Once "Win_C.inc" 'Constants
Include Once "Win_D.inc" 'Declarations
Include Once "Win_G.inc" 'Graphics
Function WndProc(byval hWnd as long,byval wMsg as long, byval wParam as long,byval lparam as long) as long callback
if wMsg = WM_CREATE
'
elseif wMsg = WM_PAINT
'
elseif wMsg = WM_MOUSEMOVE
xMouse = LoWord(lParam)
yMouse = HiWord(lParam)
'
elseif wMsg = WM_DESTROY
PostQuitMessage 0
else
Function = DefWindowProc hWnd,wMsg,wParam,lParam
endif
End Function
/* DECLARATIONS */
/* VARIABLES */
Dim hwnd, sx, iHdc,hFont as long
Dim s as string
s = "MERRY CHRISTMAS"
hwnd = SetWindow "OxygenBasic",500,400,WS_DLGFRAME
bHdc = SetBuffer WinWidth, WinHeight
iHdc = CreateImage 1000,400
hFont = CreateFont (128,20,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"times")
SelectObject iHdc,hFont
SetBkMode iHdc,1
SetTextcolor iHdc,RGB(0,255,0)
Randomize
/* MAINLOOP */
While EscKey() =0
ClearImage iHdc,1000,400 '<-- DContex, ImageWidth, ImageHeight
SetTextcolor iHdc,RGB(255,155,255)
TextOut iHdc,500,100,s,Len(s)
CopyImageRect iHdc,sx,0,500,400,0,0 '<-- DContex, xImage, yImage, ImageWidth, ImageHeight, xBuffer, yBuffer
sx +=1
if sx =980 then sx =0
DoEvents
FlipBuffer
'Sleep 10
Wend
FreeBuffer
FreeImages
ExitProcess 0
/* FUNCTIONS */
IndexBase 0
Include Once "Win_C.inc" 'Constants
Include Once "Win_D.inc" 'Declarations
Include Once "Win_G.inc" 'Graphics
Function WndProc(byval hWnd as long,byval wMsg as long, byval wParam as long,byval lparam as long) as long callback
if wMsg = WM_CREATE
'
elseif wMsg = WM_PAINT
'
elseif wMsg = WM_MOUSEMOVE
xMouse = LoWord(lParam)
yMouse = HiWord(lParam)
InValidateRect hwnd,0,0
'
elseif wMsg = WM_DESTROY
PostQuitMessage 0
else
Function = DefWindowProc hWnd,wMsg,wParam,lParam
endif
End Function
/* DECLARATIONS */
/* VARIABLES */
Dim hwnd, sa, sx, iHdc, hFont as long
Dim s as string
s = "HAPPY NEW YEAR"
hwnd = SetWindow "OxygenBasic o24",500,400,WS_DLGFRAME
bHdc = SetBuffer WinWidth, WinHeight
iHdc = CreateImage 1000,400
hFont = CreateFont (160,22,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"times")
SelectObject iHdc,hFont
SetBkMode iHdc,1
SetTextcolor iHdc,RGB(0,255,0)
Randomize
SetTextcolor iHdc,RGB(255,155,55)
TextOut iHdc,500,100,s,Len(s)
/* MAINLOOP */
While EscKey() =0
ClearBuffer()
CopyImageRect iHdc,sx,0,500,400,0,0
For sa=1 To 50
Circle,bHdc,Rand(1,499),Rand(1,399),Rand(8,48),Rand(Rgb(64,64,64),Rgb(255,255,255))
Next
sx +=2
if sx >=990 then sx =0
DoEvents
FlipBuffer()
'Sleep 10
Wend
FreeBuffer()
FreeImages()
ExitProcess 0
/* FUNCTIONS */
IndexBase 0
Include Once "Win_C.inc" 'Constants
Include Once "Win_D.inc" 'Declarations
Include Once "Win_G.inc" 'Graphics
Function WndProc(byval hWnd as long,byval wMsg as long, byval wParam as long,byval lparam as long) as long callback
if wMsg = WM_CREATE
'
elseif wMsg = WM_PAINT
'
elseif wMsg = WM_MOUSEMOVE
xMouse = LoWord(lParam)
yMouse = HiWord(lParam)
InValidateRect hwnd,0,0
'
elseif wMsg = WM_DESTROY
PostQuitMessage 0
else
Function = DefWindowProc hWnd,wMsg,wParam,lParam
endif
End Function
'============
create 'invoke macro
'============
/* MAINLOOP */
While EscKey() =0
ClearBuffer()
'=========
run 'invoke macro
'=========
DoEvents
FlipBuffer()
Sleep 5
Wend
FreeBuffer()
FreeImages()
ExitProcess 0
'=========
def create
'=========
/* DECLARATIONS */
/* VARIABLES */
Dim hwnd, sa, sx, iHdc, hFont as long
Dim s as string
s = "HAPPY NEW YEAR"
hwnd = SetWindow "OxygenBasic o24",500,400,WS_DLGFRAME
bHdc = SetBuffer WinWidth, WinHeight
iHdc = CreateImage 1000,400
hFont = CreateFont (160,22,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"times")
SelectObject iHdc,hFont
SetBkMode iHdc,1
SetTextcolor iHdc,RGB(0,255,0)
Randomize
SetTextcolor iHdc,RGB(255,155,55)
TextOut iHdc,500,100,s,Len(s)
type vector4i sys a,b,c,d
vector4i circ[50]
For sa=0 to 49
circ[sa].a=Rand(1,499)
circ[sa].b=Rand(1,399)
circ[sa].c=Rand(8,48)
circ [sa].d=Rand(Rgb(64,64,64),Rgb(255,255,255))
Next
/* FUNCTIONS */
end def 'create
'======
def run
'======
CopyImageRect iHdc,sx,0,500,400,0,0
sx +=2 : if sx >=990 then sx =0
'
For sa=0 To 49
Circle,bHdc,circ[sa].a,circ[sa].b,circ[sa].c,circ[sa].d
c=circ[sa].c
if c>=48 then circ[sa].a=Rand(1,499) : circ[sa].b=Rand(1,399) : c=8
circ[sa].c=c+1
Next
end def
include "Win_F.inc"
IndexBase 0
Include Once "Win_C.inc"
Include Once "Win_D.inc"
Include Once "Win_G.inc"
Function WndProc(byval hWnd as long,byval wMsg as long, byval wParam as long,byval lparam as long) as long callback
if wMsg = WM_CREATE
'
elseif wMsg = WM_PAINT
'
elseif wMsg = WM_MOUSEMOVE
xMouse = LoWord(lParam)
yMouse = HiWord(lParam)
InValidateRect hwnd,0,0
'
elseif wMsg = WM_DESTROY
PostQuitMessage 0
else
Function = DefWindowProc hWnd,wMsg,wParam,lParam
endif
End Function
Declare Function LoadPicture(byval pfile as string) as long
Declare Function DrawToImage(byval PicHdc As Long, byval x1 As Long, byval y1 As Long, byval w as long, byval h as long)
Declare Function FreePicture()
Dim jc,bHdc,iHdc,dir,pHnd(10),pHdc(10) as long
Dim s1,s2,s3,s4,s5,s6,s7,s8 as long
SetWindow "HappyShow 2010",320,264,WS_DLGFRAME
bHdc = SetBuffer WinWidth,WinHeight
iHdc = CreateImage 2560,264
s1 = LoadPicture "pics/christball320x240.bmp"
s2 = LoadPicture "pics/snowman320x240.bmp"
s3 = LoadPicture "pics/wintersnow320x240.bmp"
s4 = LoadPicture "pics/christmas320x240.bmp"
s5 = LoadPicture "pics/tannen320x240.bmp"
s6 = LoadPicture "pics/newtree320x240.bmp"
s7 = LoadPicture "pics/morewinter320x240.bmp"
s8 = LoadPicture "pics/happy320x240.bmp"
DrawToImage s1,0,0,320,240
DrawToImage s2,320,0,320,240
DrawToImage s3,640,0,320,240
DrawToImage s4,960,0,320,240
DrawToImage s5,1280,0,320,240
DrawToImage s6,1600,0,320,240
DrawToImage s7,1920,0,320,240
DrawToImage s8,2240,0,320,240
While EscKey() =0
CopyImageRect iHdc,jc,0,320,240,0,0
if dir =0
jc = jc +2
if jc >=2240 Then dir =1
elseif dir =1
jc = jc -2
if jc <=0 Then dir =0
endif
DoEvents
FlipBuffer
Sleep 10
Wend
FreeBuffer
FreeImages
FreePicture
ExitProcess 0
Function LoadPicture(byval pfile as string) as long
static co as long
co += 1
pHnd(co) = LoadImage(0, pfile, 0, 0, 0, 16)
pHdc(co) = CreateCompatibleDC(hdc)
SelectObject pHdc(co), pHnd(co)
Function = pHdc(co)
End Function
Function FreePicture()
For c=1 To 8
DeleteObject pHnd(c): DeleteDC pHdc(c)
Next
End Function
Function DrawToImage(byval PicHdc As Long,byval x1 As Long, byval y1 As Long, byval w as long, byval h as long)
BitBlt iHdc, x1, y1, w, h, PicHdc, 0, 0, &hCC0020
End Function
IndexBase 0
Include Once "Win_C.inc" 'Constants
Include Once "Win_D.inc" 'Declarations
Include Once "Win_G.inc" 'Graphics
Function WndProc(byval hWnd as long,byval wMsg as long, byval wParam as long,byval lparam as long) as long callback
if wMsg = WM_CREATE
'
elseif wMsg = WM_PAINT
'
elseif wMsg = WM_MOUSEMOVE
xMouse = LoWord(lParam)
yMouse = HiWord(lParam)
'
elseif wMsg = WM_DESTROY
PostQuitMessage 0
else
Function = DefWindowProc hWnd,wMsg,wParam,lParam
endif
End Function
Dim pi, v, v3, v4, x, y, x2, y2, x3, y3, x4, y4, x5, y5, n, p as single
Dim s, bHdc, hFont as long
pi = 3.14159
SetWindow "Rotate...", 640, 500, WS_MINIMIZEBOX | WS_OVERLAPPED
bHdc = SetBuffer 640,500
hFont = CreateFont (32,20,0,0,FW_BOLD,0,0,0,0,0,0,0,0,"times")
SelectObject bHdc,hFont
SetBkMode bHdc,1
While (WinExit =0) & (EscKey()=0)
ClearBuffer()
SetTextColor bHdc,Rgb(200, 240, 0)
TextOut bHdc,90,0,"YOU NEEDN'T WAIT!",17
For v =0 To 7
v = v + 0.008
if v = 6.28 Then v=0
v3 = v3 + .003
v4 = v4 + .01
if v3 >= 6.28 Then v3 = 0.003
if v4 >= 6.28 Then v4 = 0.01
x = Cos(v3) * 180 + (Cos(v) * -20 + 320)
y = Sin(v3) * 180 + (Sin(v) * -20 + 240)
x2 = Cos(v3) * 180 + (Cos(v) * 20 + 320)
y2 = Sin(v3) * 180 + (Sin(v) * 20 + 240)
x3 = Cos(v3) * 180 + (Cos(v) * 0 + 320)
y3 = Sin(v3) * 180 + (Sin(v) * 0 + 240)
x4 = Cos(v) * 20 + 320
y4 = Sin(v) * 20 + 240
x5 = Cos(v4) * 80 + 320
y5 = Sin(v4) * 80 + 240
Circle bHdc, x3, y3, 20, Rgb(100, 200, 255)
Circle bHdc, x4, y4, 40, Rgb(22, 220, 100)
Circle bHdc, x5, y5, 10, Rgb(255, 120, 50)
Next
DoEvents
FlipBuffer
Sleep 24
Wend
Beep 440,400
FreeBuffer()
ExitProcess 0
Macro Rebirth
Stars[i].yStar = Rand(1, yRes - 2)
Stars[i].speed = Rand(1, 20) * 0.1 + 1
End Macro
Macro LoWord(a)
a & 0xFFFF 'Low part
End Macro
Macro HiWord(a)
a>>16 'High part
End Macro
a=0xFFFF0064
print HiWord(a) '65535
print LoWord(a) '100
'&' is a bit better because