Author Topic: Rotation xyz  (Read 3000 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Rotation xyz
« on: April 04, 2012, 10:54:26 AM »
Deleted
« Last Edit: April 11, 2015, 10:30:02 AM by Peter »

Charles Pegge

  • Guest
Re: Rotation xyz
« Reply #1 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
« Last Edit: April 05, 2012, 04:01:55 PM by Charles Pegge »

Aurel

  • Guest
Re: Rotation xyz
« Reply #2 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 ???

Aurel

  • Guest
Re: Rotation xyz
« Reply #3 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.. :-\

Aurel

  • Guest
Re: Rotation xyz
« Reply #4 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.. ::)

Aurel

  • Guest
Re: Rotation xyz
« Reply #5 on: April 07, 2012, 11:56:16 AM »
No.
As i said window grab background as picture ???
It looks like use back hdc...

Aurel

  • Guest
Re: Rotation xyz
« Reply #6 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.

Charles Pegge

  • Guest
Re: Rotation xyz
« Reply #7 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