Author Topic: New tinyptc library  (Read 19779 times)

0 Members and 1 Guest are viewing this topic.

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
New tinyptc library
« on: September 12, 2006 »
I compiled a new tinyptc library using directdraw to replace the older one with a proper vertical screen sync enabled (in fullscreen mode) and I'm wondering if you can test it for me  :)

The new library looks a bit big (295kb) but when you compile your program, everything should be OK again...

To install:

1 - Make a backup of your older files: libtinyptc.a and libtinyptc-win.a of this folder C:\FreeBasic\lib\win32

2 - From "libtinyptc.rar" extract and copy the new tinyptc library ( libtinyptc.a and libtinyptc-win.a) to this folder: 
C:\FreeBasic\lib\win32

Everything should work like the older tinyptc, in windowed mode there's no correct vertical sync (so you will need a delta time system)  but in fullscreen mode it should work fine, anyway it's a good idea to use a delta time system...

Have fun!

Ps: Added a great source code example for you to test   ;)
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: New tinyptc library
« Reply #1 on: September 12, 2006 »
Fab; just what I was after. I'll test this out for you as soon as pos dude.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: New tinyptc library
« Reply #2 on: September 12, 2006 »
Seems to be running brilliantly mate. I did spot it doing a brief pause once whilst running the scroller, but it didnt happen again.
Welldone Rbraz.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: New tinyptc library
« Reply #3 on: September 12, 2006 »
Thanks for testing it ... 8)
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: New tinyptc library
« Reply #4 on: September 12, 2006 »
im finding it quite a bit slower than the previous one it probably runs at round half the speed.

also how did you get rid of the init and main subs.
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: New tinyptc library
« Reply #5 on: September 12, 2006 »
He's using what was missing from the proper Tiny_PTC library stuff. Mainly the Direct Draw bits that were for the syncing, for some reason they were left out. This version doesnt use any of the OGL stuff that used similar subs / functions to pretend they were from the TinyPTC library. I think this is great. And am still testing.

One thing I have noticed Rbraz dude, is that I can no longer use keys in my program loops. All except the Escape key.
I you look at one of my source codes I sent you; you'll see the following key implementation below. This however no longer works with your new groovy update.

Code: [Select]
Dim Key As String
While Key<>Chr(27)

UpdateEffect()

If Key=Chr(9) Then 'Tab key
   DoSomething()
End If

PTC_Update @ScreenBuffer(0)

Key=Inkey()

Wend

Cheers and great stuff,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New tinyptc library
« Reply #6 on: September 12, 2006 »
I will give this a good testing tonight and post back my results :) Thanks Rbraz.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New tinyptc library
« Reply #7 on: September 12, 2006 »
Hehe, nice to see the sine scroll as the example.
I have tested several programs with this and they all work beautifully! Thanks Rbraz :)
The other thing I noticed is that it generates even smaller exes than tinyptc!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New tinyptc library
« Reply #8 on: September 12, 2006 »
I've tried this on 3 very different platforms now and none of them have fallen over.
Looks really stable!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: New tinyptc library
« Reply #9 on: September 13, 2006 »
I have just compiled into static library the C source code of tinyptc windows v.0.8 found here http://sourceforge.net/project/showfiles.php?group_id=5722

And that tinyptc only support "Escape" key , to use with FB someone have added a way to intercept keyboard in main code of tptc and that's why it is a little bit bigger (when compiled) than this one.

But you can check if a key was pressed in your code just using windows API command "GetAsyncKeyState", check out the code below:

Code: [Select]
option explicit
option static

'-------------------------------------
'Windowed
'-------------------------------------
#define PTC_WIN

'-------------------------------------
' Includes.
'-------------------------------------
#include "tinyptc.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( "Tinyptc - Key Test", XRES, YRES ) = 0 ) Then
    End -1
End if


    while(1)
           
            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
           
            'Check for TAB key
            if (GetAsyncKeyState(VK_TAB)) then
                c = &hffff0000
            else
                c = &hff0000ff
            end if
               
           
            ptc_update(@buffer(0))
           
            erase buffer
           
    wend

Press TAB to change bar colors, take a look at winuser.bi for more virtual key codes.

Btw, you can define your own, for example:
#define VK_A   65       'Define key "VK_A" which the ASCII code is 65 (A)



Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: New tinyptc library
« Reply #10 on: September 13, 2006 »
Thanks matey.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: New tinyptc library
« Reply #11 on: September 13, 2006 »
Thanks matey.

no probs  :)

Quote
Hehe, nice to see the sine scroll as the example.
The best example for sure!
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: New tinyptc library
« Reply #12 on: September 15, 2006 »
No bugs have been found, how about sticky this topic  ?
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New tinyptc library
« Reply #13 on: September 15, 2006 »
You can sticky it too ya know mate :)
Anyway, it's stuck!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: New tinyptc library
« Reply #14 on: September 15, 2006 »
Cool  8)
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: New tinyptc library
« Reply #15 on: September 16, 2006 »
And how's about sending it to Victor. :D
I think he's Brazillian too.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: New tinyptc library
« Reply #16 on: September 16, 2006 »
Nah, it's not necessary, because the people who like to use tinyptc are all here   :cheers:
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New tinyptc library
« Reply #17 on: September 16, 2006 »
I'm going to leave this topic here, but it needs a dupe in the showcase. Was going to add it earlier on but I wanted to leave this topic intact for feedback. :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: New tinyptc library
« Reply #18 on: September 16, 2006 »
I just thought you'd get some credit for making tinyptc with vertical synching. If I were you, I would send it to the dude many would benefit. But it's your call.

Nice work too dude.

I have a DirectX problem that im trying to fix; which isnt due to the new update to tinyptc.

Cheers and nice one,
Clyde.

Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: New tinyptc library
« Reply #19 on: September 16, 2006 »
It's nice to have it here though Clyde don't you think? It's good to make tools like this only available to the members that support our place.
Shockwave ^ Codigos
Challenge Trophies Won: