Page 17 of 24
RE: EZRotate
Posted: Sat Feb 28, 2009 6:32 pm
by Onyx
Thanks for the example code, Mistrel!
Yes, it does seem to drift quite badly.
One other thing-
Since I will be resizing my parent window, how would I resize the DB window? Is this something I have to do through the Windows API?
PureBasic uses the ResizeWindow command, but I don't see anything to resize the DB window.
Posted: Sat Feb 28, 2009 6:39 pm
by Olby
Mistrel wrote:Olby wrote:Yeah I saw that thread right before I posted here. But they are documented in the DBPro help files so sooner or later I think they will be fixed. Anyways I got another question, yes I am a boring person
In DBPro we could use syntax like this to mask the objects, but PB says it's incorrect:
Code: Select all
dbSetObjectMask(drDirectLightObject, 2^(drDeferredCamera+2) )
What should I change ?
There is no "^" operator. Try this:
Code: Select all
dbSetObjectMask(drDirectLightObject, Pow((drDeferredCamera+2,2)) )
Ahh, I see. Gotta learn PB faster. Thanks that works.
Posted: Sat Feb 28, 2009 6:43 pm
by Mistrel
dbSetWindowSize() will stretch the screen pixels to whatever size you want.
Changing the actual resolution is a lot trickier. Whenever you change the resolution of the Direct3D render device you have to reload all of your assets. Luckily, PureGDK has a solution for this too. Using special callbacks you can recover from invalidated render devices with ease (albeit you still have to reload your assets).
Have a look at the d3d callbacks example included with the samples from the latest beta:
http://puregdk.com/files/upload/PureGDK ... -1.1b3.zip
I also recently provided a complete example on how to apply these functions to a more complex program:
Here is an example of how to tie in recovery for an invalid render device with changing the display resolution. This is useful for windowed applications that want to reset the device resolution after resizing the window.
This example also demonstrates how to safely handle rendering in a thread and also how to maintain a given aspect ratio when altering the device resolution.
See here:
http://www.purebasic.fr/english/viewtop ... 398#278398
Window Resizing
Posted: Sat Feb 28, 2009 7:52 pm
by Onyx
Mistrel,
So if I create the Main window and the DB render window at the largest size initially, then resize down from there, will I still be able to resize back to the largest size and maintain quality?
In other words, if you start out creating the DB render window at the largest size you want to allow, will the quality of the window be maintained if I resize down, then resize back up at a later time?
Posted: Sat Feb 28, 2009 7:58 pm
by Mistrel
That would work, yes. But you'll run into various scaling problems in text output, and aliasing.
Posted: Sun Mar 01, 2009 8:58 pm
by Mistrel
Posted: Mon Mar 02, 2009 8:38 am
by Olby
Are you also going to wait until the 7.2 update is finished ?
Posted: Mon Mar 02, 2009 2:42 pm
by Mistrel
Finished? It's already been released. There's nothing in it that would affect PureGDK.
http://darkbasicpro.thegamecreators.com/?f=upgrade_7_2
Posted: Mon Mar 02, 2009 3:07 pm
by Olby
Sorry I meant the 7.3 that was mentioned in the newsletter. From what I understand you are going to wait until the 7.3 is released and then put out PGDK final/stable release? I am just curious... I am not waiting for the 3d Cloth & Particle - I have it already, I just want to see what new stuff 7.3 brings to DBP. Need to check if there is an beta thread for 7.3 alredy...

Posted: Mon Mar 02, 2009 3:11 pm
by Mistrel
It won't be a major update and I already have test examples for cloth to verify the new commands. It won't put the beta on hold, unless it comes out before it ends. Then I might extend it by a week.
Posted: Mon Mar 02, 2009 4:25 pm
by Olby
Mistrel wrote:I already have test examples for cloth to verify the new commands.
You mean there will be some new commands added to the 3d cloth & particles or they are the same as before just integrated with DBPro as an update?
Posted: Mon Mar 02, 2009 4:30 pm
by Mistrel
Core libraries are integrated differently than framework libraries so there is a chance for bugs. That's what I mean by it will require testing.
MouseZ functions
Posted: Mon Mar 02, 2009 4:31 pm
by Onyx
Mistrel,
It appears at least some of the MouseZ functions do not work. I converted a very basic DarkBasic example (less the mouse icon routines) over to test. Here's the PureBasic+PureGDK code:
Code: Select all
OpenWindow(0,0,0,640,480,"DarkBasic Professional - PureGDK",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
hDBWnd=OpenDBWnd(WindowID(0),0,0,640,480)
dbSyncRate(60)
dbBackdropOn()
dbColorBackdrop(dbRGB(0,0,0))
Repeat
dbText(0,10,"mousemovex "+Str(dbMouseMoveX()))
dbText(0,20,"mousemovey "+Str(dbMouseMoveY()))
dbText(0,30,"mousemovez "+Str(dbMouseMoveZ()))
dbText(0,40,"mouse position x "+Str(dbMouseX()))
dbText(0,50,"mouse position y "+Str(dbMouseY()))
dbText(0,60,"mouse position z "+Str(dbMouseZ()))
dbText(0,70,"Press 1 to hide mouse")
dbText(0,80,"Press 2 to show mouse")
dbText(0,90,"Press 5 to position mouse to top of screen")
If dbInKey()="1"
dbHideMouse()
EndIf
If dbInKey()="2"
dbShowMouse()
EndIf
If dbInKey()="5"
dbPositionMouse(dbMouseX(),0)
EndIf
If dbMouseClick()=1
dbText(0,100,"left mouse button")
EndIf
If dbMouseClick()=2
dbText(0,100,"right mouse button")
EndIf
dbSync()
Until WindowEvent()=#PB_Event_CloseWindow Or dbKeyState(#VK_ESCAPE)
End
When I run this, all the functions seem to work except for the mousepositionz and mousemovez. Neither of them seem to function when I use my mouse wheel.
To verify, here's the DB code to run in DarkBasic:
Code: Select all
do
cls
print "mousemovex "+str$(mousemovex())
print "mousemovey "+str$(mousemovey())
print "mousemovez "+str$(mousemovez())
print "mouse position x "+str$(mousex())
print "mouse position y "+str$(mousey())
print "mouse position z "+str$(mousez())
print "Press 1 to hide mouse"
print "Press 2 to show mouse"
print "Press 3 to change mouse image"
print "Press 4 to change mouse image back"
print "Press 5 to position mouse to top of screen"
if scancode()=2 then hide mouse
if scancode()=3 then show mouse
if scancode()=4 then change mouse 1
if scancode()=5 then change mouse 0
if scancode()=6 then position mouse mousex(),0
if mouseclick()=1 then print "left mouse button"
if mouseclick()=2 then print "right mouse button"
loop
end
When I run the DarkBasic Version, I see changes in the mousemovez and mousepositionz listings.
This appears to be a PureGDK bug.
Posted: Tue Mar 03, 2009 5:00 pm
by Mistrel
Fixed this for the next release. Thanks for the bug report.

New Release?
Posted: Fri Mar 06, 2009 12:54 pm
by Onyx
Any news on when the next release will be out?