Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 LibPyro- Library that extends Turings functionality
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DarkRider




PostPosted: Sat Jan 24, 2009 10:59 pm   Post subject: LibPyro- Library that extends Turings functionality

This library contains several modules that extend Turings existing functionality. I have found that when using Turing I am constantly writting code to do a certain task over and over again, so I thought why compile a library. I started to look through all the projects I have made in Turing and started to compile this library that helped darastically reduce the amount of code lines in those projects.

This package contains three of the modules I have been compiling:
    PString- Contains functions that will format given strings, replace, remove, repeat or add phrases to strings, convert to lower case or upper case, or check for patterns.
    PMath- Contains functions that carry out mathematical operations including conversion, trigonometric and geometric, exponention and logarithmic, and find the number of digits in a integer or real values.
    PRand- Contains functions that will generate a random value either between a given lower and higher bound or a list of values.
I have also been working on other modules as well including:
    Keyboard and mouse interaction- Extends the functionality of Turings Input and Mouse modules
    Graphics- Very extensively extends the functionality of Turings Draw module.
    Colours- Expands upon Turings RGB module and gives the ability to blend colours together, get "pure" colours, and create a colour by passing RGB values between 0-255.
    Interface- Replacement of Turings GUI module, which will allow the user to create any kind of interface.
    Debug- Imporvement and expansion upon Turings Error module, which will log Turings error messages, allow you to enter your own log entries, output any previous error message, or dump all error messages logged to a file.
The modules listed above are not fully completed and I haven't finalized the design of them yet, so I am not posting them just yet.

If you have any suggestions for these modules or other modules I would really appreciate the input!

Edit:

To use the library move the libPyro folder into your projects directory and type:

Turing:
import include "libPyro/libPyro.t"


at the beginning of your program. For some reason that slipped my mind when I submitted the library, also not all the modules will work by themselve without modification of some of the code.

Edit2:

I forgot to modify the import paths from what they were pre-release. Fixed. (I am having a bad day to say the least...)



libPyro.zip
 Description:
Library that extends Turings functionality.

Download
 Filename:  libPyro.zip
 Filesize:  7.17 KB
 Downloaded:  241 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
The_Bean




PostPosted: Sun Jan 25, 2009 12:16 am   Post subject: Re: LibPyro- Library that extends Turings functionality

It's great that you are putting together libraries for the common functions that you use, but some of them are already in turing, or there is a much better/faster way of doing them.

In the Math section:

Extract:
--intpart = floor(num)
--realpart = num-floor(num)
Distance2D:
--Math.Distance()
Slope:
--watch out for x1=x2
RightHyp:
--Math.Distance()
Abs:
--already built in abs()
Sign:
--already built in sign()
AnyRoot:
--result num**(1/root)
Log10:
--ln(num)/ln(10)
Log:
--ln(num)/ln(base)

In PRand:
Real:
- result LowValue+(HighValue-LowValue)*Rand.Real

In PString:
Upper:
--built in turing Str.Upper()
Lower:
--built in turing Str.Lower()
Repeat:
--built in turing repeat()
DarkRider




PostPosted: Sun Jan 25, 2009 2:15 am   Post subject: Re: LibPyro- Library that extends Turings functionality

The_Bean @ Sun Jan 25, 2009 12:16 am wrote:
Extract:
--intpart = floor(num)
--realpart = num-floor(num)
AnyRoot:
--result num**(1/root)
In PRand:
Real:
- result LowValue+(HighValue-LowValue)*Rand.Real

I didn't think about coding these functions this way when I wrote them...they make perfect sense now that I see them.

The_Bean @ Sun Jan 25, 2009 12:16 am wrote:
Log10:
--ln(num)/ln(10)
Log:
--ln(num)/ln(base)

I didn't think I could use the ln function to do this!

The_Bean @ Sun Jan 25, 2009 12:16 am wrote:
Slope:
--watch out for x1=x2

Right, if X2 and X1 are the same than X2 - X1 would result in zero which would cause the slope to be undefined, thus resulting in an error from Turing.

The_Bean @ Sun Jan 25, 2009 12:16 am wrote:
Distance2D:
--Math.Distance()
RightHyp:
--Math.Distance()
Abs:
--already built in abs()
Sign:
--already built in sign()
In PString:
Upper:
--built in turing Str.Upper()
Lower:
--built in turing Str.Lower()
Repeat:
--built in turing repeat()

I know that I could of just used the native Turing functions in place of these, but I included them to show how the functions could be created. I commented out these functions (except for RightHyp) so that the module is more of an extention to Turing, and just left them commented out for educational use.

Thanks for pointing out the above, I have credited you for the changes and have changed my code appropriately. It's always good to get suggestions for your work! Makes it much better Smile !



libPyro.zip
 Description:
Fixes to some of the functions mentioned in the above post.

Download
 Filename:  libPyro.zip
 Filesize:  7.88 KB
 Downloaded:  215 Time(s)

SNIPERDUDE




PostPosted: Sun Jan 25, 2009 9:47 pm   Post subject: RE:LibPyro- Library that extends Turings functionality

It's always interesting to see a new Turing Library made. For effects I think a particle engine would be a major add.

Keep up the good work


I see you're going to create an interface upgrade, I am curious to see how you do this.
Check out mine if you want for ideas, and let me know if you have anything I could add:
http://compsci.ca/v3/viewtopic.php?t=19091&postdays=0&postorder=asc&start=15
DarkRider




PostPosted: Mon Jan 26, 2009 1:45 pm   Post subject: RE:LibPyro- Library that extends Turings functionality

I am trying to create a particle engine, but it's hard to create a general engine as particles act differently depending on what you want to do with them.

For my interface library/engine I am trying to create it so that the user has full control over how the graphics of their objects look at any time during execution of their program. The syntax doesn't vary much from Turings GUI module but it is a lot faster. I haven't implemented too much functionality just yet, just thinking about the overall design of it first without going to in-depth with the coding.

I'll have a look at yours and see how you have created your interface library/engine, and give you some feedback.

Edit (version 0.2):

I updated libPyro with two new modules, PInput and PMouse. PInput extends the functionality of Turings Input module, which simplifies the process of reading the computers keyboard information. PMouse extends the functionality of Turings Mouse module, which like PInput simplifies process of reading the computers mouse information. Both modules have the ability to check for pressed, released and held buttons, and is able to pause a program until a button is pressed, released, or held.

I don't think there is anything that needs to be added to the avaiable modules, so unless somebody has an idea for any available module, I won't be updating them. I have two other modules that are almost complete, so I'll add those once they are. Also I have added a version tag to this package, and will continue to do so that way I can keep track of what has been changed from version to version.

Edit 2 (version 0.25):

I was thinking about the design of PInput and PMouse and I came to the conclusion that during some cases the user may not want the input information updated every check but every interval of time or they may want to update the information manually. You can now specify the amount of miliseconds for the modules to wait until they update themselves, or you can also update the modules yourselve.



libPyro.zip
 Description:
Version 0.25. Changed they way the PInput and PMouse modules update themselves, and gave the user the ability to update the modules information themselve. See above post for more information.

Download
 Filename:  libPyro.zip
 Filesize:  12.23 KB
 Downloaded:  192 Time(s)


libPyro.zip
 Description:
Version 0.2. Adds two new modules, PInput and PMouse. See above post for more information.

Download
 Filename:  libPyro.zip
 Filesize:  11.57 KB
 Downloaded:  191 Time(s)

DarkRider




PostPosted: Wed Jan 28, 2009 7:19 pm   Post subject: Re: LibPyro- Library that extends Turings functionality

I attached a new version of libPyro that includes an extension to Turings RGB module, dubbed PColour. This module offers very simple to use tools that allow you to easily and effectively manipulate colours in your programs. I have another module that I am working that will vastly extend Turings Draw module adding the ability to rotate shapes and a greater list of shapes that should help in creating graphics for games and such. PColour is not final yet, I still want to add a little bit more functionality to it, but I am not entirely sure how I am going to implement this functionality.

My debug library is coming along nicely and I have a good design for my interface library/engine, that I will extensively start working on once I am finished with my graphics library and one other library that contains common types (or records) that have come in handy when creating games. All of the libPyro libaries that I have created, or will be creating, will be incorporated into the interface library/engine.

P.S. Sorry for double posting. I wanted other people to see the thread on the front page in case they may not know about the thread or do not usually browse through specific sections.



libPyro.zip
 Description:
Version 0.3. Adds a new colour module that extends Turings RGB module. See above post for more information.

Download
 Filename:  libPyro.zip
 Filesize:  15.08 KB
 Downloaded:  212 Time(s)

genius12




PostPosted: Sun May 06, 2012 2:19 pm   Post subject: RE:LibPyro- Library that extends Turings functionality

Good job. I have now learned to make modules and how effectively they can be used in programming; especially in Turing.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: