Dark Bit Factory &  Gravity

Dark Bit Factory & Gravity

  • July 30, 2010 *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Pages: 1 [2]   Go Down

Author Topic: Tiny Future Composer Player for C/C++, FreeBasic and PureBasic  (Read 2423 times)

0 Members and 1 Guest are viewing this topic.

Clyde

  • A Little Fuzzy Wuzzy
  • Contributing Author
  • Senior Member
  • ******
  • Karma: 71
  • Offline Offline
  • Posts: 6965
    • View Profile
Thanks. :D

I am getting crashes whenever the program stops with using TinyPTC. Try out the listing above, and see if it does the same for you.

Cheers and much appreciated,
Clyde
Logged
If only I knew then what I know now.

energy

  • Atari ST
  • ***
  • Karma: 14
  • Offline Offline
  • Posts: 183
    • View Profile
    • WWW
Hi Slippy

Yes... where ever i can i use the Static Lib with Purebasic! (u can do that with the commando Import(StaticLib)
it seems that theres an export from MSVCR70.dll
Will test with the other lib from MinGW

Cheers eNeRGy
Logged
Purebasic 4.3, MASM

slippy

  • Atari ST
  • ***
  • Karma: 41
  • Offline Offline
  • Posts: 172
    • View Profile
    • WWW
Hey Clyde,

I didn't encounter any problems when quitting a TinyPTC project ... attached there's a little example (although it's been compiled with FB 0.18 ... perhaps this is the solution to your problem??!)

I wonder if it crashes on your PC upon exit ... please let me know ...

@energy: I just tried it myself and I get unresolved symbol errors on compile - I'm no PB crack ... sorry - perhaps we might hand over this question to some of the other guys here ... :/

SLiPPY

« Last Edit: October 06, 2007 by slippy »
Logged

Clyde

  • A Little Fuzzy Wuzzy
  • Contributing Author
  • Senior Member
  • ******
  • Karma: 71
  • Offline Offline
  • Posts: 6965
    • View Profile
Ace SLiPPY K++ works great in FB 18, thanks for the info and help.

Note: Just to let you know using the TinyPTC_Ext still produces the error upon exitting.

Cheers and all the very best,
Clyde.
« Last Edit: October 06, 2007 by Clyde »
Logged
If only I knew then what I know now.

Jim

  • ADMIN
  • Senior Member
  • ********
  • Karma: 325
  • Offline Offline
  • Posts: 4676
    • View Profile
Just as an experiment, try stopping the FC player before exiting PTC.
Jim
Logged

Clyde

  • A Little Fuzzy Wuzzy
  • Contributing Author
  • Senior Member
  • ******
  • Karma: 71
  • Offline Offline
  • Posts: 6965
    • View Profile
Tried that Jim, and still occurs.
Logged
If only I knew then what I know now.

Shockwave

  • good/evil
  • ADMIN
  • Senior Member
  • ********
  • Karma: 356
  • Offline Offline
  • Posts: 15085
  • evil/good
    • View Profile
    • WWW
Please post the latest source so that the problem can be fixed.. Thanks :)
Logged
Shockwave ^ Codigos....  Error: Keyboard not attached.... Press F1 to continue.

Clyde

  • A Little Fuzzy Wuzzy
  • Contributing Author
  • Senior Member
  • ******
  • Karma: 71
  • Offline Offline
  • Posts: 6965
    • View Profile
Code: [Select]
'
' Random Pixels Experiment with Future Composer
' Freebasic Version 18

Option Explicit
Option Static


#Include "tinyPTC.bi"'         "TinyPTC_Ext.bi"
#include "tiny_fc.bi"

Const XRES=640
Const YRES=480
Const ARES=XRES*YRES

Dim Shared ScreenBuffer( ARES )
dim shared dummy as integer

Declare Sub FeedPixels  ( Byval X As Integer, ByVal Y As Integer, Byval Col As Integer )

Declare Sub InitializeExperiment()
Declare Sub RunExperiment()
Declare Sub ShutDownExperiment()

Declare Function Randd(ByVal lower as integer, ByVal upper as integer) As Integer

InitializeExperiment()
RunExperiment()
ShutDownExperiment()


Sub FeedPixels  ( Byval X As Integer, ByVal Y As Integer, Byval Col As Integer )
   
    If X>0 And X<XRES-1 And Y>0 And Y<YRES-1 And Col<>0  Then
        ScreenBuffer( X + ( Y * XRES) ) = Col
    End If   
End Sub

Sub InitializeExperiment()

    initFC(0, @dummy, 0, "slipstream2.fc")
    startFC()
   
    If( ptc_open( "testing", XRES, YRES ) = 0 ) Then
        End -1                                   
    End if
   


End Sub

Sub RunExperiment()

    Dim Key As String
   
    Dim x,y
   
    While Key<>Chr(27)
       
        For y=0 To YRES-1
            For x=0 To XRES-1
               
                FeedPixels(x,y,Randd(0,&HFFFFFF))
       
            Next
        Next
       
       
        PTC_Update @ScreenBuffer(0)
        key=Inkey
    Wend

End Sub


Sub ShutDownExperiment()
   
    stopFC()   

    PTC_Close()

End Sub


Function Randd(ByVal lower as integer, ByVal upper as integer) As Integer
   
    Dim temp as integer
   
    If upper < lower then
        temp=upper
        upper=lower
        lower=temp
    End If
   
    Dim value   As integer
    Dim dist    As integer
   
    value=lower
    dist = Abs(lower-upper)
   
    Return ( Rnd(1)*dist) + value

End function
Logged
If only I knew then what I know now.

Shockwave

  • good/evil
  • ADMIN
  • Senior Member
  • ********
  • Karma: 356
  • Offline Offline
  • Posts: 15085
  • evil/good
    • View Profile
    • WWW
Here, use this and stop using out of date tinyptc library ;)

This one works well.

Code: [Select]


        #INCLUDE "TINYPTC_EXT.BI"
        #include  "tiny_fc.bi"
        #Include  "Windows.bi"

Const XRES=640
Const YRES=480
Const ARES=XRES*YRES

Dim Shared Buffer( ARES )
dim shared dummy as integer



initFC(0, @dummy, 0, "sample.fc")
startFC()


'-------------------------------------------------------------------------------
'       SET UP SCREEN;
'-------------------------------------------------------------------------------
       
        PTC_ALLOWCLOSE(0)
        PTC_SETDIALOG(0,"",0,0)   
       
        IF (PTC_OPEN("USE THIS FRAMEWORK",XRES,YRES)=0) THEN
        END-1
        END IF         

    WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<>-32767) 

    ptc_update@buffer(0)

    Wend

    ptc_close()
    stopFC()
Logged
Shockwave ^ Codigos....  Error: Keyboard not attached.... Press F1 to continue.

rbz

  • MOD
  • Senior Member
  • *******
  • Karma: 272
  • Offline Offline
  • Posts: 2133
    • View Profile
    • WWW
Shockie is right, if you need to run something after your while/wend loop you must set ptc_allowclose(0) to disable internal tinyptc library escape key support.
Logged
rbz ^ Codigos

RageSnax

  • ZX 81
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 23
    • View Profile
Hi Slippy

thanks very much for a cool lib sorry it took so long to say so  :cheers: K++

RageSnax
Logged
Pages: 1 [2]   Go Up
 

 

B l a c k R a i n V.2 by C r i p

Page created in 0.13 seconds with 18 queries.