Pres3D source

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Pres3D source

Post 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
Last edited by Kukulkan on Mon Oct 11, 2010 7:43 am, edited 1 time in total.
User avatar
flaith
Enthusiast
Enthusiast
Posts: 704
Joined: Mon Apr 25, 2005 9:28 pm
Location: $300:20 58 FC 60 - Rennes
Contact:

Re: Pres3D source

Post by flaith »

Thanks for giving us the source of your code, much appreciated :D Image
“Fear is a reaction. Courage is a decision.” - WC
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Pres3D source

Post by c4s »

Thank you, Pres3D is amazing. I hope this project doesn't die a lonely death!
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: Pres3D source

Post by ozzie »

Brilliant :!: :D Thanks for sharing.
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: Pres3D source

Post 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
User avatar
Comtois
Addict
Addict
Posts: 1429
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Pres3D source

Post by Comtois »

I like it, thank you.
Please correct my english
http://purebasic.developpez.com/
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post 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
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post 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
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Pres3D source

Post 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
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post 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
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Pres3D source

Post 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
User avatar
TomS
Enthusiast
Enthusiast
Posts: 342
Joined: Sun Mar 18, 2007 2:26 pm
Location: Munich, Germany

Re: Pres3D source

Post 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.
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post 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
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Pres3D source

Post by c4s »

If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
Michael Vogel
Addict
Addict
Posts: 2680
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Pres3D source

Post by Michael Vogel »

c4s wrote:
404 Not found.
Seems to be fixed now :D
Post Reply