Author Topic: TinyPTC Ext  (Read 51184 times)

0 Members and 4 Guests are viewing this topic.

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2751
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: TinyPTC Ext
« Reply #40 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...
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: TinyPTC Ext
« Reply #41 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
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2751
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: TinyPTC Ext
« Reply #42 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
Challenge Trophies Won:

Offline .:] Druid [:.

  • freebasic n00b
  • Pentium
  • *****
  • Posts: 563
  • Karma: 47
    • View Profile
    • Intro-Inferno
Re: TinyPTC Ext
« Reply #43 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 :)
[sheep]: im sure he wants to goto prison.. they didnt get him last time.. he was promised a big cock up his arse.. and no doubt looking forward to it.. lets hope he gets his wish this year.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17398
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: TinyPTC Ext
« Reply #44 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.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2751
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: TinyPTC Ext
« Reply #45 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
Challenge Trophies Won:

Offline WidowMaker [retired]

  • %010101
  • Atari ST
  • ***
  • Posts: 134
  • Karma: 21
  • %010101
    • View Profile
Re: TinyPTC Ext
« Reply #46 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?


Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: TinyPTC Ext
« Reply #47 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
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2751
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: TinyPTC Ext
« Reply #48 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 why WidowMaker was so worried about it.

« Last Edit: April 14, 2008 by rbz »
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2751
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: TinyPTC Ext
« Reply #49 on: July 26, 2008 »
*Library updated!

-Windowed mode bug removed
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: TinyPTC Ext
« Reply #50 on: July 26, 2008 »
Wicked stuff Rbz :)

Thanks dude :)
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: 17398
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: TinyPTC Ext
« Reply #51 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+
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: TinyPTC Ext
« Reply #52 on: July 28, 2008 »
Ive also noticed that tinyptc_ext.a is considerably smaller than before too.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline energy

  • Amiga 1200
  • ****
  • Posts: 280
  • Karma: 25
    • View Profile
Re: TinyPTC Ext
« Reply #53 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

coding: jwasm,masm
hobby: www.scd2003.de

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17398
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: TinyPTC Ext
« Reply #54 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.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2751
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: TinyPTC Ext
« Reply #55 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.
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17398
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: TinyPTC Ext
« Reply #56 on: June 27, 2009 »
Maybe it's my card then. I can do 320*240 no problem.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Moroboshisan

  • Senior Member
  • Amiga 1200
  • ********
  • Posts: 454
  • Karma: 18
  • C=64
    • View Profile
Re: TinyPTC Ext
« Reply #57 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...

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2751
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: TinyPTC Ext
« Reply #58 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 :)
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: TinyPTC Ext
« Reply #59 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.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won: