Oxygen Basic

Programming => Example Code => Topic started by: Peter on April 04, 2012, 10:54:26 AM

Title: Rotation xyz
Post by: Peter on April 04, 2012, 10:54:26 AM
Deleted
Title: Re: Rotation xyz
Post by: Charles Pegge on April 05, 2012, 03:52:47 PM
Hi Peter,

Thanks for the xyx demo,Easter card and new win64.

Unfortunately the window size adjustment is not accurate for a number of examples.

But here is a procedure which will deliver a precise adjustment to the window size, giving the desired client area

I have rather rudely dunked it into your Window() procedure  below :)

declare GetWindowRect lib "user32.dll" (sys h,RECT*r)
declare MoveWindow lib "user32.dll" (sys h,x,y,w,h,repaint)
RECT r
sys l,t,w,h
GetClientRect sys_hwnd,r
w=2*ww-r.right
h=2*wh-r.bottom
GetWindowRect sys_hwnd,r
l=r.left
t=r.top
MoveWindow sys_hwnd,l,t,w,h,1


Code: [Select]

Function Window (string caption, sys Ww, Wh, style) as sys
sys inst Wx, Wy, Scr, jx
iF style =0
   style = CheckReso Ww, Wh
EndiF      
iF style =1 then style =0xCF0000
iF style =2 then style =0x80000
iF style =3 then style =0x80000000
iF style =4 then style =0x400000
inst = GetModuleHandle 0
wc.style = CS_HREDRAW or CS_VREDRAW or CS_OWNDC
wc.lpfnWndProc = &WndProc
wc.cbClsExtra =0
wc.cbWndExtra =0
wc.hInstance  = inst
wc.hIcon=LoadIconA 0,IDI_WINLOGO            
wc.hCursor=LoadCursor 0,IDC_ARROW      
wc.hbrBackground = 0
wc.lpszMenuName  = ?0
wc.lpszClassName = @"Oxygen"
RegisterClass &wc
Scr = GetSystemMetrics SM_CXSCREEN
Wx  = (Scr - Ww) /2
Scr = GetSystemMetrics SM_CYSCREEN
Wy  = (Scr - Wh) /2
'sys_hwnd = CreateWindowEx 0, wc.lpszClassName,caption,style,Wx,Wy,Ww+16,Wh+38,0,0,inst,0
sys_hwnd = CreateWindowEx 0, wc.lpszClassName,caption,style,Wx,Wy,Ww,Wh,0,0,inst,0
'
declare GetWindowRect lib "user32.dll" (sys h,RECT*r)
declare MoveWindow lib "user32.dll" (sys h,x,y,w,h,repaint)
RECT r
sys l,t,w,h
GetClientRect sys_hwnd,r
w=2*ww-r.right
h=2*wh-r.bottom
GetWindowRect sys_hwnd,r
l=r.left
t=r.top
MoveWindow sys_hwnd,l,t,w,h,1
'
ShowWindow sys_hwnd,SW_SHOW
sys_hdc = GetDC(sys_hwnd)
GetClientRect sys_hwnd, rc
bHnd = CreateCompatibleBitmap(sys_hdc, rc.right, rc.bottom)
bHdc = CreateCompatibleDC(sys_hdc)
SelectObject bHdc, bHnd
ScreenWidth = rc.right: ScreenHeight = rc.bottom
sys_Seed = timeGetTime
QueryPerformanceFrequency sys_qf
QueryPerformanceCounter   sys_qc1
Return sys_hwnd
End Function

Sub Pause()
While AscKey=0
Events
iF WinExit=1
   WinEnd
   ExitProcess 0
End iF
FlipBuffer
sleep 20
Wend
'AscKey=0
End Sub

Charles
Title: Re: Rotation xyz
Post by: Aurel on April 07, 2012, 09:54:30 AM
UNfortunatly Peter ...
your code have a error or something is not ok:
Syntax :
Word: ,
line : 22

col=GetBmpPixel p1,x,y

What might be this ???
Title: Re: Rotation xyz
Post by: Aurel on April 07, 2012, 10:21:16 AM
Hi Peter

When i change this line into given i recive error like is on screenshot.
uffff.. :-\
Title: Re: Rotation xyz
Post by: Aurel on April 07, 2012, 10:38:39 AM
Hmm it looks that work but i replace your window() function with charles and now work
like screen capture program, oh what a mess.. ::)
Title: Re: Rotation xyz
Post by: Aurel on April 07, 2012, 11:56:16 AM
No.
As i said window grab background as picture ???
It looks like use back hdc...
Title: Re: Rotation xyz
Post by: Aurel on April 08, 2012, 04:33:06 AM
What is library.sdlbas   ???
SDLbasic like name tell use sdl.dll not directX.
But from what i know i dont think so that sdl basic is so fast.
Title: Re: Rotation xyz
Post by: Charles Pegge on April 08, 2012, 07:57:35 AM

You will always get higher performance using the Graphics hardware, especially when drawing lists are compiled. Then the CPU has very little to do.

Charles