Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: Rbz on February 16, 2007

Title: TinyPTC Ext
Post by: Rbz on February 16, 2007
Here's a new tinyptc version that I made for Shockwave some time ago, in this new version you will capable to switch to fullscreen or windowed mode when the app start, it uses directdraw and mmx routines, like the original tpc.
Here's the function list:

Standard ptc functions:
ptc_open
ptc_update
ptc_close

Tinyptc extension
ptc_setflip
ptc_getmousex
ptc_getmousey
ptc_getleftbutton
ptc_getrightbutton
ptc_setdialog
ptc_allowclose
ptc_getwindow
ptc_setmousewheel *new
ptc_getmousewheel *new

To install:
From "tinyptc_ext.rar" extract and copy the new tinyptc library ( libtinyptc_ext.a and libmmx.a) to this folder:
C:\FreeBasic\lib\win32
And "tinyptc_ext.bi" to the folder C:\FreeBasic\inc

If you need some example code, I'll post it later...

Have fun!
Title: Re: TinyPTC Ext
Post by: Shockwave on February 16, 2007
Thank you for releasing this for everyone Rbraz. +10 Karma! It's a fabulous extension.
Title: Re: TinyPTC Ext
Post by: bbear on February 16, 2007
thank you very much  :goodpost:
Title: Re: TinyPTC Ext
Post by: Rbz on February 16, 2007
No problem  :cheers:
Title: Re: TinyPTC Ext
Post by: Shockwave on February 16, 2007
I just want to say that this extension has made *everything* I have done in FB possible. It is just perfect and very kind of you to release it so that people can use it. You've made a great thing there mate and it's the one thing I could not do without... Of course there are other things you have made that I need too, those are bin2bas and bmp2raw. You made my life so much easier with those things, I'll never be able to thank you enough.
Title: Re: TinyPTC Ext
Post by: rdc on February 16, 2007
Very cool indeed.
Title: Re: TinyPTC Ext
Post by: .:] Druid [:. on February 17, 2007
 :clap: :clap: :clap:

Nice one Rbraz!  Thanks a lot!

 :clap: :clap: :clap:
Title: Re: TinyPTC Ext
Post by: zawran on February 17, 2007
Cool of you to release it, karma coming your way. Unfortunately I have decided to stick with Bmax due to the limited time I spend on code these days, but otherwise I would just right on the bandwagon as this makes everything so much easier.
Title: Re: TinyPTC Ext
Post by: Rbz on February 19, 2007
No problem dudes, it's my pleasure :)

Here's a little code using mouse functions:

Code: [Select]
option explicit
option static

'-------------------------------------
' Includes.---------------------------
'-------------------------------------
#include "tinyptc_ext.bi"
#include "windows.bi"

'Screen width x height
Const XRES = 640
Const YRES = 480

dim shared buffer(XRES*YRES) as integer

dim shared as integer x,y1,y2
dim shared as double angle
dim c as integer

c = &hff0000ff

If( ptc_open( "Mouse Test", XRES, YRES ) = 0 ) Then
    End -1
End if


    while(GetAsyncKeyState(VK_ESCAPE)<>-32767)
       
            y1 = 80 + sin(angle)*20
            angle += 0.05
           
            for x=0 to 639
                buffer(x+(y1*XRES)) = c
            next

            y2 = 400 + cos(angle)*20
           
            for x=0 to 639
                buffer(x+(y2*XRES)) = c
            next
                     
            cls
            locate 1,1
            print "Mouse Xpos: ";ptc_getmousex()
           
            locate 2,1
            print "Mouse Ypos: ";ptc_getmousey()
           
            locate 4,1
            print "Left Mouse Button: ";ptc_getleftbutton()

            locate 5,1
            print "Right Mouse Button: ";ptc_getrightbutton()


            ptc_update(@buffer(0))
           
            erase buffer
           
    wend
Title: Re: TinyPTC Ext
Post by: rdc on February 20, 2007
If you are using this on .17 then you'll need to change the $inclib to #inclib in the bi file, since .17 doesn't use the older format.
Title: Re: TinyPTC Ext
Post by: DrewPee on February 20, 2007
rbraz,
thanks matey - i agree with shockwave - you are one of the most helpful people on here!  :clap:
karma up +++

Drew
Title: Re: TinyPTC Ext
Post by: Rbz on March 03, 2007
Thanks DrewPee  :)


I know that some people hates that window asking for fullscreen mode  ;) , so I've added a new function capable to enable/disable message box,  and if you enable it you can choose your own text for it.

ptc_setdialog(1,"Do you really want FullScreen ?",0)

First option will disable messagebox, the 2nd option you will choose your text, the 3rd option will let you start direct in fullscreen or windowed mode when first option disables messagebox.

ptc_setdialog(0,"bla",1) 'Disable messagebox, and start in windowed mode

ptc_setdialog(0,"bla",0) 'Disable messagebox, and start in fullscreen mode

Add it before you open your ptc window

Code: [Select]
ptc_setdialog(1,"Do you really want Full Screen ?",0)
if ( ptc_open ( "TEST....", 640, 480) = 0 ) then
end -1
end if

have fun  ;D



Title: Re: TinyPTC Ext
Post by: Shockwave on March 03, 2007
That's just the ticket Rbraz. Very useful and I'll be using it in th intro I am making for S!P.

Thank you kindly.

Have some Karma.
Title: Re: TinyPTC Ext
Post by: Rbz on March 04, 2007
No problem Shockie

Here's a little example using ptc_setdialog

Code: [Select]
'
'
'  "ptc_setdialog" command test
'        by rbraz 2007
'
'
'-------------------------------------
' Includes.
'-------------------------------------
#include once "tinyptc_ext.bi"
#include "windows.bi"

dim shared buffer(640*480) as integer
dim text as string

text = " ¤´¨) " & chr$(13)
text += " ¸.·´¸.·*´¨) ¸.·*¨)" & chr$(13)
text += "(¸.·´ (¸.·`¤... SHOCKWAVE ^ DBF ^ S!P ...¤" & chr$(13) & chr$(13) & chr$(13)
text += "FullScreen Mode ?"

ptc_setdialog(1,text,0)

'Open TinyPTC window
If( ptc_open( "ptc_setdialog command test", 640, 480 ) = 0 ) Then
    End -1
End if

'Main Loop
while(GetAsyncKeyState(VK_ESCAPE)<>-32767)
    ptc_update @buffer(0)
wend

I guess that you can see the possibilities for this  ;)
Title: Re: TinyPTC Ext
Post by: rdc on March 04, 2007
Excellent lib here. Works well with the CVS version of FB too once you make the changes to the inclib statement. The original tinyptc doesn't seem to work with the CVS version.
Title: Re: TinyPTC Ext
Post by: Rbz on March 04, 2007
Sorry about the inclib statement, I'm still using the old 0.15 because it works fine for me, I tried to use the new one but it give me a lot troubles.
Title: Re: TinyPTC Ext
Post by: Shockwave on March 04, 2007
Thanks for the example Rbraz. I also use fb 1.5, it works fine and does what I like so I don't upgrade mine either.
Title: Re: TinyPTC Ext
Post by: rdc on March 05, 2007
Here is a little update to the bi file; this may enable it to work with any version, if you feel so inclined. You should probably verify that this actually works with .15, since I don't have that installed and I am not sure what changes to the preprocessor were made in the different versions.

Code: [Select]
'
' TinyPTC by Gaffer
' www.gaffer.org/tinyptc
'
 
'
' TinyPTC Extension by rbraz 2007
'

#if __FB_VERSION__ < "0.17"
    '$inclib: "opengl32"
    '$inclib: "user32"
    '$inclib: "gdi32"
    '$inclib: "glu32"

    '$inclib: "mmx"
    '$inclib: "tinyptc_ext"
#else
    #inclib "opengl32"
    #inclib "user32"
    #inclib "gdi32"
    #inclib "glu32"

    #inclib "mmx"
    #inclib "tinyptc_ext"
#endif


#inclib "opengl32"
#inclib "user32"
#inclib "gdi32"
#inclib "glu32"

#inclib "mmx"
#inclib "tinyptc_ext"

'tinyptc api
declare function ptc_open cdecl alias "ptc_open" (byval title as zstring ptr, byval width as integer, byval height as integer ) as integer
declare function ptc_update cdecl alias "ptc_update" (byval buffer as integer ptr) as integer
declare function ptc_close cdecl alias "ptc_close" () as integer

'tinyptc extension
declare function ptc_setflip cdecl alias "ptc_setflip" (byval interval as integer) as integer
declare function ptc_getmousex cdecl alias "ptc_getmousex" () as integer
declare function ptc_getmousey cdecl alias "ptc_getmousey" () as integer
declare function ptc_getleftbutton cdecl alias "ptc_getleftbutton" () as integer
declare function ptc_getrightbutton cdecl alias "ptc_getrightbutton" () as integer
declare function ptc_setdialog cdecl alias "ptc_setdialog" (byval enable as integer, byval text as zstring ptr, byval mode as integer ) as integer


I also added the As Integer function return type on the setdialog since it didn't have an explicit return type. Implicit types causes an error unless -lang QB is set. Since the others had an explicit return type, I assumed it was probably just an oversight.

Anyway, thanks for the good work on this.


Title: Re: TinyPTC Ext
Post by: Voltage on March 05, 2007
Great lib rbraz!

What does ptc_setflip do?
Title: Re: TinyPTC Ext
Post by: Shockwave on March 05, 2007
ptc_setlip() Allows you to switch vsync on or off.
ptc_setflip(1)
ptc_setfilp(0)

Will try that updated .bi Rick, Have some Karma.
Title: Re: TinyPTC Ext
Post by: Rbz on March 06, 2007
Thanks rdc, works fine here, added it into the zip file.

Title: Re: TinyPTC Ext
Post by: BadMrBox on March 06, 2007
Hey all. Got tempted to test this new version of tinyptc so I decided to finally become a member of this board.
Great stuff rbraz!
Title: Re: TinyPTC Ext
Post by: Shockwave on March 06, 2007
 :hi: And thanks for your comments in the other FB sites on the gfx demos, it's nice to see you here. If you have any questions about anything at all you find on this site, please do not hesitate at all in asking. I have used Rbraz's library to release lots of demo scene productions, including this one DUTCH COLOURS - POUET (http://www.pouet.net/prod.php?which=29681) which got a .90 average at Pouet which is really good going and shows how good this library is :)
Title: Re: TinyPTC Ext
Post by: BadMrBox on March 06, 2007
Thanks Shockwave. I'll let you know if there is something I dont figure out here :)
Title: Re: TinyPTC Ext
Post by: Rbz on March 08, 2007
 :hi: BadMrBox


Added a new feature to the library -> ptc_allowclose

With ptc_allowclose(0) command you will be able to disable tinyptc internal Escape key check. Use ptc_allowclose(1) to enable it again, just place this command before you open your window (ptc_open)

Here's a little example:

Code: [Select]
'
'
'  "ptc_setdialog" command test
'        by rbraz 2007
'
'
'-------------------------------------
' Includes.
'-------------------------------------
#include once "tinyptc_ext.bi"
#include "windows.bi"

dim shared buffer(640*480) as integer
dim text as string

text =  " ¤´¨) " & chr$(13)
text += " ¸.·´¸.·*´¨) ¸.·*¨)" & chr$(13)
text += "(¸.·´ (¸.·`¤... SHOCKWAVE ^ DBF ^ S!P ...¤" & chr$(13) & chr$(13) & chr$(13)
text += "FullScreen Mode ?"

ptc_setdialog(1,text,0)

ptc_allowclose(0) 'disable tinyptc to close on Escape Key press
'ptc_allowclose(1) 'enable tinyptc to close on Escape Key press

'Open TinyPTC window
If( ptc_open( "ptc_setdialog command test", 640, 480 ) = 0 ) Then
    End -1
End if


'Main Loop
'
' If you use ptc_allowclose(0)
'This app will only terminate if you press "F1" key

while(GetAsyncKeyState(VK_F1)<>-32767)
    ptc_update @buffer(0)
wend

ptc_close()
Title: Re: TinyPTC Ext
Post by: Shockwave on March 08, 2007
Thanks for the new feature Rbraz :)
Title: Re: TinyPTC Ext
Post by: Rbz on May 31, 2007
*Update*
"ptc_setdialog"  -> Added a new parameter to disable window border as Shockwave suggested.


Example:
Code: [Select]
'
'
'  "Borderless Window" command test
'        by rbraz 2007
'
'
'-------------------------------------
' Includes.
'-------------------------------------
#include "tinyptc_ext.bi"
#include "windows.bi"

dim shared buffer(640*480) as integer

'-------------------------------------------------------------------------------
'1st param. = Enable messagebox (dialog)
'2nd param. = Messagebox text
'3rd param. = Start in fullscreen or windowed mode if 1st param. is zero
'4th param. = Window normal border (0) or borderless (1)
ptc_setdialog(0,"",1,1)
'-------------------------------------------------------------------------------

ptc_allowclose(1) 'enable tinyptc_ext to close on Escape Key press

'Open TinyPTC window
If( ptc_open( "Borderless Window test", 640, 480 ) = 0 ) Then
    End -1
End if

dim i
for i=0 to 640*480
     buffer(i) = &h00334466
next

'Main Loop
while(1)
    ptc_update @buffer(0)
wend

ptc_close()
Title: Re: TinyPTC Ext
Post by: Shockwave on May 31, 2007
Works nice Rbraz :)

Beautiful!
Title: Re: TinyPTC Ext
Post by: Jim on June 08, 2007
I know I took this code out before, but it's been pointed out to me that handling the SC_SCREENSAVE WM_SYSCOMMAND message doesn't work on Vista any more.  Don't know why.

Rbraz, can you please add in the following to the startup and shutdown routines?
Code: [Select]
static BOOL screen_save_active;
static void disable_screensaver(void)
{
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &screen_save_active, 0);
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);

DWORD dwReturnValue;
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETSCREENSAVEACTIVE, (LPARAM)"Desktop", SMTO_ABORTIFHUNG, 5000, &dwReturnValue);

SetThreadExecutionState(ES_DISPLAY_REQUIRED|ES_CONTINUOUS);
}

static void enable_screensaver(void)
{
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, screen_save_active, NULL, 0);
DWORD dwReturnValue;
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETSCREENSAVEACTIVE, (LPARAM)"Desktop", SMTO_ABORTIFHUNG, 5000, &dwReturnValue);
}

This version is slightly more friendly than the one that was removed - it tells other apps that we've changed a setting, and restores the setting when we've finished.

Cheers!

Jim
Title: Re: TinyPTC Ext
Post by: Rbz on June 08, 2007
Ok Jim, I'll add that function, thanks.
Title: Re: TinyPTC Ext
Post by: Rbz on June 10, 2007
@Jim: I'm having troubles to compile it, freebasic refuse to include "SetThreadExecutionState", tried to include kernel32 lib ('$inclib: "kernel32") and #define WIN_INCLUDEALL, whitout success, it give this error:
Quote
Compiler output:
.//libtinyptc_ext.a(ddraw.o): In function `disable_screensaver':
E:/Programming/TinyPTC/Tinyptc_Library/devcpp/ddraw.c:70: undefined reference to `SetThreadExecutionState'

Results:
Compilation failed

System:
FBIde: 0.4.6
fbc:   FreeBASIC Compiler - Version 0.15 for win32 (target:win32)
OS:    Windows XP (build 2600, Service Pack 2)

Btw, I'm using the original source of tinyptc by gaffer, and to disable screensaver it use this:
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, 0);
and to enable again:
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, 0, 0);
Have you checked if it's working?
Title: Re: TinyPTC Ext
Post by: Jim on June 11, 2007
I'll have a look.  For now, just remove the SetThreadExecutionState line.  You should still get the code to call SendMessageTimeout to notify other applications that you've changed a system setting, and the other code to preserve the existing state of that setting.  Gaffer's code assumes the screensaver is enabled before and after the app has run, which might not be true!

Jim
Title: Re: TinyPTC Ext
Post by: Rbz on June 12, 2007
*Updated*

Added Jim code to disable/enable screensaver, compatible with Vista, tested on WinXp sp2 too.
Title: Re: TinyPTC Ext
Post by: Jim on June 12, 2007
Thanks!

Jim
Title: Re: TinyPTC Ext
Post by: WidowMaker [retired] on June 30, 2007
Awesome work Rbraz. I use this.
Title: Re: TinyPTC Ext
Post by: Jim on September 12, 2007
Is it possible to add a function that will retrieve the HWND of the window opened by PTC?

Jim
Title: Re: TinyPTC Ext
Post by: Shockwave on January 02, 2008
Mouse functions?

These work well, I like the ability to be able to monitor the buttons and the position of the mouse, however in many things it would be preferable to have your own mouse pointer.

So with this in mind here is a test application..

(attached).

And the code:

Code: [Select]
'
' Mouse Test
'
    OPTION STATIC
    OPTION EXPLICIT

    #INCLUDE "TINYPTC_EXT.BI"
    #INCLUDE "WINDOWS.BI"
   
    CONST   XRES    =   800
    CONST   YRES    =   600
   
    DIM SHARED AS UINTEGER BUFFER ( XRES * YRES )
   
    PTC_ALLOWCLOSE(0)
    PTC_SETDIALOG(1,"Fullscreen?",0,1)                 
    IF (PTC_OPEN("OSUK",XRES,YRES)=0) THEN
    END-1
    END IF     

    DIM SHARED AS INTEGER MX,MY
   

WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<> -32767)

    MX=PTC_GETMOUSEX()
    MY=PTC_GETMOUSEY()
   
    BUFFER(MX+(MY*XRES)) = &HFFFFFF
    PTC_UPDATE@BUFFER(0)
    ERASE BUFFER
   
WEND
   
    PTC_CLOSE()
    END

Please select fullscreen mode when you run it, then move the mouse around. I plot a dot at mouse x , mouse y

Now press Alt+tab to minimize the application.
Re-instate it and you see that the default mouse pointer is being displayed.

How do you turn off the mouse pointer so this cannot happen please?

Also the default pointer is visible in windowed mode, again it would be nice to be able to turn this off.

Cheers if you can help!
Title: Re: TinyPTC Ext
Post by: benny! on January 02, 2008
Do not know FreeBasic - do you have access to the WinAPI functions ???
If so, you may try ShowCursor(bool) function from user32.dll.
Maybe this helps out!
Title: Re: TinyPTC Ext
Post by: Shockwave on January 02, 2008
Good tip Benny :)
Worked first time.

After including windows.bi

Code: [Select]
dim as integer mouse   
mouse=ShowCursor(0)

Have some good Karma Benny :)
Title: Re: TinyPTC Ext
Post by: benny! on January 02, 2008
Thanks mate - glad that it works !!!
Title: Re: TinyPTC Ext
Post by: Rbz on January 05, 2008
Good tip Benny :)
Worked first time.

After including windows.bi

Code: [Select]
dim as integer mouse   
mouse=ShowCursor(0)

Have some good Karma Benny :)
Nice  :)

Is it possible to add a function that will retrieve the HWND of the window opened by PTC?

Jim

Sorry Jim, ~3 months delayed :( , if you still want this feature I can add it for you...
Title: Re: TinyPTC Ext
Post by: Jim on January 05, 2008
If you're tinkering, yes, it would be very handy.  Often you need the hwnd to pass to Windows API functions, especially GDI (if you want the DC, for example) and DirectX (for pretty much anything).
HWND ptc_get_window() or something.  Maybe you need to make it return just a dword to avoid breaking loads of code not including windows.bi.
Jim
Title: Re: TinyPTC Ext
Post by: Rbz on January 06, 2008
Ok Jim, I have updated it (first post attachment), I must confess it's very useful function, for example, someone can setup directx 9 and use some handy texture loaders etc...

Here's a little example, it just hide and show ptc main window:
Code: [Select]
option explicit
option static

'-------------------------------------
' Includes.---------------------------
'-------------------------------------
#include "tinyptc_ext.bi"
#include "windows.bi"

'Screen width x height
Const XRES = 800
Const YRES = 600
dim shared buffer(XRES*YRES) as integer

ptc_setdialog(0,"",1,0)

If( ptc_open( "ptc_getwindow", XRES, YRES ) = 0 ) Then
    End -1
End if

dim shared hwnd as HWND
hwnd = ptc_getwindow()

dim flag as integer
flag=0


while(GetAsyncKeyState(VK_ESCAPE)<>-32767)
   
    if(flag=0) then   
        ShowWindow(hwnd, SW_HIDE)
    else
        ShowWindow(hwnd, SW_SHOW)
    end if
   
    Sleep(2000)
    flag=flag xor 1

    ptc_update(@buffer(0))
    erase buffer
           
wend
Title: Re: TinyPTC Ext
Post by: .:] Druid [:. on January 12, 2008
Simply brilliant!  I finally updated my version and it's really impressive (for me at least hehe)

karma for everybody involved :)
Title: Re: TinyPTC Ext
Post by: Shockwave on January 14, 2008
Simply brilliant!  I finally updated my version and it's really impressive (for me at least hehe)

karma for everybody involved :)

It was about time you updated :) You make some really nice programs that deserve a smooth refresh rate.
Title: Re: TinyPTC Ext
Post by: Rbz on March 08, 2008
Library updated!

Added Mousewheel functions:

- ptc_setmousewheel
- ptc_getmousewheel

And here a simple example:

Code: [Select]
'-------------------------------------
' Includes.---------------------------
'-------------------------------------
#include "tinyptc_ext.bi"
#include "windows.bi"

'Screen width x height
Const XRES = 640
Const YRES = 480

dim shared buffer(XRES*YRES) as integer

dim shared as integer x,y1,y2
dim shared as double angle
dim c as integer

c = &hff4466ff

'No dialog
ptc_setdialog(0,"",1,0)

'Set mousewheel default values
'Range = 1 (Movement range)
'Delta = 0 (Start value for delta)
ptc_setmousewheel(1, 0)

If( ptc_open( "Mouse Test", XRES, YRES ) = 0 ) Then
    End -1
End if

    while(GetAsyncKeyState(VK_ESCAPE)<>-32767)
       
            y1 = 80 + sin(angle)*20
            angle += 0.05
           
            for x=0 to 639
                buffer(x+(y1*XRES)) = c
            next

            y2 = 400 + cos(angle)*20
           
            for x=0 to 639
                buffer(x+(y2*XRES)) = c
            next
                     
            cls
            locate 1,1
            print "Mouse Xpos: ";ptc_getmousex()
           
            locate 2,1
            print "Mouse Ypos: ";ptc_getmousey()
           
            locate 4,1
            print "Left Mouse Button: ";ptc_getleftbutton()

            locate 5,1
            print "Right Mouse Button: ";ptc_getrightbutton()

            locate 7,1
            print "MouseWheel: ";ptc_getmousewheel()

            ptc_update(@buffer(0))
           
            erase buffer
           
    wend
Title: Re: TinyPTC Ext
Post by: WidowMaker [retired] on March 09, 2008
Quote
Is it possible to add a function that will retrieve the HWND of the window opened by PTC?

Jim

:( Is this what ruined the window setup of this great lib?
Title: Re: TinyPTC Ext
Post by: Jim on March 09, 2008
Shouldn't do - all it is doing is exposing a variable from the innards of ptc that lets any program reference the window handle - which is needed to initialise Direct3D or to pass to many other Windows functions.

Jim
Title: Re: TinyPTC Ext
Post by: Rbz on April 12, 2008
Quote
Is it possible to add a function that will retrieve the HWND of the window opened by PTC?

Jim

:( Is this what ruined the window setup of this great lib?
Just for further reference you can read here (http://dbfinteractive.com/index.php?topic=2949.0) why WidowMaker was so worried about it.

Title: Re: TinyPTC Ext
Post by: Rbz on July 26, 2008
*Library updated!

-Windowed mode bug removed
Title: Re: TinyPTC Ext
Post by: Clyde on July 26, 2008
Wicked stuff Rbz :)

Thanks dude :)
Title: Re: TinyPTC Ext
Post by: Shockwave on July 27, 2008
Widowmaker was jumping for joy yesterday :)

He's using the new one on the next issue of the charts.
Nice one Rbz, K+
Title: Re: TinyPTC Ext
Post by: Clyde on July 28, 2008
Ive also noticed that tinyptc_ext.a is considerably smaller than before too.
Title: Re: TinyPTC Ext
Post by: energy on June 23, 2009
A bit late by never to late!!!   ;D
Here is the Purebasic version this cool Lib.
Purebasic Users are now able to use this fantastic lib from Rbraz too!
in this package are all sources and Purebasic User lib for Version PB4.xx

Cheers and have fun
eNeRGy

Title: Re: TinyPTC Ext
Post by: Shockwave on June 27, 2009
Hi Rbz,

What are the screen limitations of ptc_ext?

I had problems when trying to open larger screens than 800 * 600.. 1024 * 768 just didn't work properly at all.
Title: Re: TinyPTC Ext
Post by: Rbz on June 27, 2009
Hmm, I can open a screen of 1280 x 1024 without any problems, windowed mode and full screen.

But I can't open a 320 x 240 full screen mode, my graphics card doesn't support it anymore.
Title: Re: TinyPTC Ext
Post by: Shockwave on June 27, 2009
Maybe it's my card then. I can do 320*240 no problem.
Title: Re: TinyPTC Ext
Post by: Moroboshisan on June 28, 2009
Hi rbz,

I hard about some kind of trouble with nvidia cards, old resolutions support (modex and dos resolution support) was disabled in firmwares for some unknown reason... maybe a different card would work fine...
Title: Re: TinyPTC Ext
Post by: Rbz on June 29, 2009
Indeed, I've a Nvidia 8800, I've also heard that those modes will be back (or I was dreaming about), dunno when :)
Title: Re: TinyPTC Ext
Post by: Clyde on June 29, 2009
I've noticed a strange occurrence when running in a window, that it doesnt clear itself properly, plus when you move the window around there's an unwanted effect which i can just about summarize as I dont know the technical term, it's similar to a blur.
Title: Re: TinyPTC Ext
Post by: Hezad on July 17, 2009
Hum ... Sorry if the question has already been asked before but is there a way to use Tiny PTC under linux ? I see it needs windows.bi :S
Title: Re: TinyPTC Ext
Post by: Jim on July 18, 2009
Unfortunately not, it uses DirectX to do the drawing.

Jim
Title: Re: TinyPTC Ext
Post by: Moroboshisan on July 18, 2009
Unfortunately not, it uses DirectX to do the drawing.

noob question [remember that i'm just starting to learn some basic coding... I hope so]: TinyPTC uses DX? I thought [haven't inspected the code yet] it uses OpenGL....

BTW

is there a way to use Tiny PTC under linux ? I see it needs windows.bi :S

This is the reason why I personally really love software render... you do not rely upon anything, just a bunch of algorithm you can recompile for whatever platform you need to run on! The drawback is lot of CPU time and the need to code basic painting routines from scratch.... obviously you do not need dual core GPUs with 1GB of Ram...
Title: Re: TinyPTC Ext
Post by: Jim on July 18, 2009
We used to use OpenGL, but we had trouble with compatibility so rbz made it use DirectDraw instead.
I can fish out the old code, but it's still dependent on Windows initialisation.  Easy enough to fix if it moved to use glut.

Effectively tiny_ptc_ext is there exactly so we can do pixel bashing/software rendering in FB without worrying about DirectX, OpenGL or any of the other stuff.  It provides a framebuffer and a way of moving it up to the screen.

Jim
Title: Re: TinyPTC Ext
Post by: Clyde on July 18, 2009
btw, please use this version of tinyptc_ext.bi if you are planning on using bass for music.
as the other download for tinyptc_ext++.bi ( exactly the same version as in here ) and comes with ufmod which will clash with bass definitions & variables etc. as i have discovered.
Title: Re: TinyPTC Ext
Post by: Shockwave on July 18, 2009
btw, please use this version of tinyptc_ext.bi if you are planning on using bass for music.
as the other download for tinyptc_ext++.bi ( exactly the same version as in here ) and comes with ufmod which will clash with bass definitions & variables etc. as i have discovered.

If you are following my tutorials, don't take this advice for now, this is something you can will move on to later.
Title: Re: TinyPTC Ext
Post by: Hezad on July 18, 2009
Thanks for your answers mates !

Quote
Effectively tiny_ptc_ext is there exactly so we can do pixel bashing/software rendering in FB without worrying about DirectX, OpenGL or any of the other stuff.  It provides a framebuffer and a way of moving it up to the screen.

So I could use tiny_ptc_ext on linux ? The reason I want to use it is that a lot of stuff here is coded with tiny ptc (or with tiny_ ptc_ext ?) and since I'm on linux for some time now, I'd like to be able to run all those nice snippets/demos ;)
Title: Re: TinyPTC Ext
Post by: Shockwave on July 18, 2009
Hezad, since your software rendered stuff is so lovely I'd love to see them re-coded using tinyptc_ext, just for the speed boost :)
Title: Re: TinyPTC Ext
Post by: Hezad on July 18, 2009
Well I'll take a look at tiny_ptc_ext then  ;D Some speed improvement is always good  :D
Title: Re: TinyPTC Ext
Post by: Jim on July 18, 2009
Again, this version of tinyptc won't work on Linux, since it uses DirectX. It provides a framebuffer in a very portable way so that FB demo writers don't have to care about the underlying hardware/drivers, but it means that you would need a Linux-based version of it.

Jim
Title: Re: TinyPTC Ext
Post by: TinDragon on July 18, 2009
I dont know if under FB in linux you have access to opengl commands, if you do you could emulate the way tinyptc works, I did this in blitzmax back when rabz/jims framework used opengl I made a version and used glDrawPixels command to copy the framebuffer from memory to the backbuffer. You would need some way to open the opengl window/screen but if FB offers opengl in linux it will have some way to do this.
Title: Re: TinyPTC Ext
Post by: Clyde on July 18, 2009
I wouldnt be at all surprised if there exists all ready a linux counterpart to tinyptc. Maybe the artist formerlly known as rbraz ( rbz ) knows any more.
Title: Re: TinyPTC Ext
Post by: Rbz on July 18, 2009
@Hezad: as Jim said, this fb library is windows compatible only.
You can find here http://www.dbfinteractive.com/forum/index.php/topic,672.0.html one version using opengl, maybe you can try to recode it to linux.

btw, please use this version of tinyptc_ext.bi if you are planning on using bass for music.
as the other download for tinyptc_ext++.bi ( exactly the same version as in here ) and comes with ufmod which will clash with bass definitions & variables etc. as i have discovered.
I wonder why one would use ufmod + bass sound system in the same app  :-\
Anyway it's proved here http://www.dbfinteractive.com/forum/index.php/topic,3806.msg56347.html#msg56347 that it can work just fine :)

... when rabz/jims framework used opengl ...
Who is this guy called rabz...  :-\


 
Title: Re: TinyPTC Ext
Post by: Shockwave on July 18, 2009

I wonder why one would use ufmod + bass sound system in the same app  :-\
 

I must admit I am struggling with that one too.
The only reason I could see to use bass as opposed to Ufmod is if you were using an incompatible format (an mp3 for instance), ufmod is much smaller and really excellent for tracker stuff.
Title: Re: TinyPTC Ext
Post by: Hezad on July 19, 2009
Thanks for the link ! I'll check that, a linux conversion would be cool I guess :) Otherwise, I could directly use open GL too, no ? AFAIK, using open gl for 2D rendering is just a matter of plotting pixels on a texture and putting this texture on screen.

(oh.. And while I'm writing this, I'm remembering my computer doesn't have any graphics acceleration since my onboard graphic chipset is not/badly handled by linux .. So Open GL or Tiny_ptc-using-open-GL won't be of any use here  :-\)
Title: Re: TinyPTC Ext
Post by: Rbz on June 12, 2011
Updated
- Removed an "unwanted feature" (=bug :)) on windowed mode.
Title: Re: TinyPTC Ext
Post by: Shockwave on June 12, 2011
Thanks for continuing to support your great lib!