Page 1 of 3

Pres3D source

Posted: Mon Oct 11, 2010 7:30 am
by Kukulkan
Hi,

I opened a new thread, because this is basically another thing.

I release the source of Pres3D (presenting using PureBasic http://www.purebasic.fr/english/viewtop ... 14&t=43856) in this post. I choosed the LGPL licence, so you all are free to manipulate and use the code.

Please download here: http://www.x-beliebig.info/Download/Pre ... source.zip

It is commented and all files are included. It is programmed using PureBasic 4.50 (Windows).

The reason: I'm not having enough time to develop an editor and continue development of the core presentation code. As I think that this will never earn some significant amount of money in the future, it will be better held as an open source project. It would be nice, if someone will keep a hand on it. For me, it has been an experiment and the wish to confirm an idea. So, it is confirmed (successfully) and now the project is finished for me. Thank you all for the kind comments.

Kukulkan

Re: Pres3D source

Posted: Mon Oct 11, 2010 7:42 am
by flaith
Thanks for giving us the source of your code, much appreciated :D Image

Re: Pres3D source

Posted: Mon Oct 11, 2010 7:54 am
by c4s
Thank you, Pres3D is amazing. I hope this project doesn't die a lonely death!

Re: Pres3D source

Posted: Mon Oct 11, 2010 8:31 am
by ozzie
Brilliant :!: :D Thanks for sharing.

Re: Pres3D source

Posted: Mon Oct 11, 2010 6:11 pm
by Vera
Hi Kukulkan,
how great is that ~ Image ~ thank you with joy

Well I managed to add a small feature which enables one to choose a different *.xml presentation from the application folder if the default 'slide.xml' is unavailable. I missed this most of all for to quickly test different presentations - meaning different effect settings. (next shall be drag&drop)
Might not be the smartest solutions but it works fine and I'd like to share it with you.

Besides I rounded my html-version of the docu which I also like to share in case someone prefers html over pdf too. ;)

cheers ~ Vera

Code: Select all

Procedure.b OpenSlideXML(XMLFile.s)

  If LoadXML(#XML, XMLFile.s) = 0
    XMLFile = OpenFileRequester("Choose a Presentation", GetPathPart(ProgramFilename()) + "slide.xml", "XML (*.xml)|*.xml", 0 )
    If LoadXML(#XML, XMLFile.s) = 0
      ProcedureReturn #False
    EndIf
  EndIf
  
  Repeat
    If XMLStatus(#XML) <> #PB_XML_Success
      res = MessageRequester("Info", "Sorry, this was no suitable slide-file. Like to open another one ?", #PB_MessageRequester_YesNo| $50)
      If res = #PB_MessageRequester_Yes        
        XMLFile = OpenFileRequester("Again", GetPathPart(ProgramFilename()), "XML (*.xml)|*.xml", 0 )
        If LoadXML(#XML, XMLFile.s) = 0
          ProcedureReturn #False
        EndIf
      Else
        MessageRequester("Oh Well", "so maybe some other time ", $50)
        ProcedureReturn #False
      EndIf
    EndIf
  Until XMLStatus(#XML) = #PB_XML_Success

Re: Pres3D source

Posted: Tue Oct 12, 2010 6:24 pm
by Comtois
I like it, thank you.

Re: Pres3D source

Posted: Wed Oct 13, 2010 6:17 pm
by infratec
Hi,

I just tested Pres3D :!:
I think it is a nice startpoint.

It should be a normal application with a menu where you can load the presentations and so on.

So it needs a way to switch between 'normal' window and fullscreen.
Here is my first patch for Pres3D

Code: Select all

If KeyboardPushed(#PB_Key_Return)
    Status.l = GetWindowLong_(WindowID(0), -16)
    If XML_Settings\ScreenFull
      NewWidth = XML_Settings\ScreenWidth
      NewHeight = XML_Settings\ScreenHeight
      Status | #WS_CAPTION
      XML_Settings\ScreenFull = #False
    Else
      ExamineDesktops()
      NewWidth = DesktopWidth(0)
      NewHeight = DesktopHeight(0)
      Status & ~#WS_CAPTION
      XML_Settings\ScreenFull = #True
    EndIf
    SetWindowLongPtr_(WindowID(0), -16, Status)
    ; resize has to be behnd SetWindowLong_() because than the values are set
    ResizeWindow(0, 0, 0, NewWidth, NewHeight)
    
    While KeyboardPushed(#PB_Key_Return)
      ExamineKeyboard()
    Wend
  EndIf
Insert it directly after

Code: Select all

ClearScreen(XML_Settings\BackgroundColor)
  ExamineKeyboard()
  ExamineMouse()
  ExamineKeyboard()
Now you can switch to fullscreen and back by pressing the return key.

Edit:

Oh I forgot, you also have to change a 0 to a 1:

Code: Select all

ScreenRet.l = OpenWindowedScreen(WindowID(0), 0, 0, XML_Settings\ScreenWidth, XML_Settings\ScreenHeight, 0, 0, 0)
to

Code: Select all

ScreenRet.l = OpenWindowedScreen(WindowID(0), 0, 0, XML_Settings\ScreenWidth, XML_Settings\ScreenHeight, 1, 0, 0)

The 'fullscreen mode' through the xml file is now obsolete :mrgreen:

Have Fun,

Bernd

Re: Pres3D source

Posted: Thu Oct 14, 2010 1:45 pm
by infratec
Hi,

I modified now so much, that I have to provide a download:

http://www.infratec-ag.de/PureBASIC/Pres3D_V1.01.zip

What I have changed:

1. I included Veras extension

2. I implemnted the switching between fullscreen and window

3. I added a Version to the window title

4. Now you can use a filename as parameter.
So you can create a desktop link to start your presentation.

5. I added a menu
So later it is possible to load and maybe save a presentation.


What I will do next:

Add a 'Load' function to the file menu
Add a status bar where you can see at wich page we are.

Best regards,

Bernd

Re: Pres3D source

Posted: Thu Oct 14, 2010 2:50 pm
by Kukulkan
Nice work. Thank you!

But you do not really switch to fullscreen, do you? A real fullscreen mode is more performant that only using a windowed-mode in fullscreen-size.

By the way: using SetWindowLongPtr_() will reduce compatibility to windows!

Kukulkan

Re: Pres3D source

Posted: Thu Oct 14, 2010 3:34 pm
by infratec
Hi Kukulkan,

you are right with 'windows'. But in your code is

Code: Select all

; allow Sprite3D view from behind (windows-only!!!!!!)
Define pd3d.IDirect3DDevice9
!extrn _PB_Screen_Direct3DDevice
!MOV dword EAX, [_PB_Screen_Direct3DDevice]
!MOV dword [v_pd3d],EAX
pd3d\SetRenderState(22,1)
And so I thought it is already for windows only.

If you tell me that I can remove this, or for what it is good for. I search for a way to be
cross platform compatible.

And from the documentation in PureBASIC an OpenWindowScreen() has the same performance like OpenScreen().

But I have normally nothing todo with graphic, so maybe I'm wrong.

I have just implemented the 'Open' functionality. I hope I have done it right.
But I still have to avoid all the stuff, when no xml is loaded at start.
At the moment this is not possible of course of Vera's code.
But I think it should be possible to start the application without loaded xml.

Hm, at the moment I can not upload something to our web site.
So you have to wait for V1.02 :cry:

Bernd

Re: Pres3D source

Posted: Thu Oct 14, 2010 3:54 pm
by Kukulkan
Hi,

Yes, this part is the only windows-related code in the complete source. PureBasic uses a DirectX mode that shows the texture of an object (Sprite3D) only on one side. To show it on both sides, this code-snippet sets the needed switch in DirectX (as PB does not offer such a way). My hope is, that this trick is not needed at all on linux or MacOS.

Maybe someone will test this and inserts some plattform dependent variation of this part:

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Linux 
  ; allow Sprite3D view from behind (windows-only!!!!!!)
  Define pd3d.IDirect3DDevice9
  !extrn _PB_Screen_Direct3DDevice
  !MOV dword EAX, [_PB_Screen_Direct3DDevice]
  !MOV dword [v_pd3d],EAX
  pd3d\SetRenderState(22,1)
CompilerEndIf
Kukulkan

Re: Pres3D source

Posted: Thu Oct 14, 2010 4:12 pm
by TomS
Without having a look at the source:

Most performant ------------------------- least performant
Fullscreen - Windowedscreen - Autostretched Windowedscreen

If you open the windowedscreen in the same resolution as the desktop is, you should be fine.

Re: Pres3D source

Posted: Thu Oct 14, 2010 9:41 pm
by infratec
Hi,

as promised, here is the link to V1.02

http://www.infratec-ag.de/PureBASIC/Pres3D_V1.02.zip

Now you can open a new xml file via the menue.

I'll check tomorrow what happens in Linux.

Bernd

Re: Pres3D source

Posted: Thu Oct 14, 2010 10:37 pm
by c4s

Re: Pres3D source

Posted: Fri Oct 15, 2010 7:58 am
by Michael Vogel
c4s wrote:
404 Not found.
Seems to be fixed now :D