Page 1 of 1

Transer Lib

Posted: Fri Aug 24, 2018 10:13 am
by JamieVanCadsand
Hey 2D Programmers...,

I get here an simple library, called to draw simple 2d radial circles... with given it an count...
Here is the source code, don't edit them.




Source Code:

Code: Select all

;***************************************************************************************************************************
;* Transer.pbi - Version 1.0 ***********************************************************************************************
;***************************************************************************************************************************
;***************************************************************************************************************************
Global X.i = 0
Global Y.i = 0
Global Between.i = 0
Global Radius.i = 0
Global Rotation.i = 0
Global Wave.i = 0
Global Colour.i = 0




;Transer_Circle(X, Y, Between, Radius, Rotation, Count, Colour)
Procedure Transer_Circle_Defeult(X, Y, Between, Radius, Rotation, Count, Colour)
  
  For I = 1 To Count
    Circle(X + (Between * (I * Cos(Radian(Rotation)))), 
           Y + (Between * (I * Sin(Radian(Rotation)))), Radius, Colour)
  Next
  
EndProcedure



;Transer_Circle_Wave(X, Y, Between, Radius, Rotation, Wave, Limit, Count, Colour)
Procedure Transer_Circle_Wave(X, Y, Between, Radius, Rotation, Wave, Count, Colour)
  
  For I = 1 To Count
    Circle(X + (I * (Wave * Cos(Radian(Rotation)))),
           Y + (I * (Wave * Sin(Radian(Rotation)))), Radius, Colour)
  Next
  
EndProcedure
;Transer_Circle_Diffrence(X, Y, Between, Radius, Rotation, Diffrence, Count, Colour)



Procedure Transer_Circle_Diffrence(X, Y, Between, Radius, Rotation, Diffrence, Count, Colour)
  
  For I = 1 To Count
    Circle(X + (Between * (I * Cos(Radian(Rotation * (I * Diffrence))))), 
           Y + (Between * (I * Sin(Radian(Rotation * (I * Diffrence))))), Radius, Colour)
  Next
  
EndProcedure



;Transer_Circle_Bow(X, Y, Between, Radius, Rotation, Diffrence, Count, Colour)
Procedure Transer_Circle_Bow(X, Y, Between, Radius, Rotation, Diffrence, Count, Colour)
  
  For I = 0 To Count
    Circle(X + (Between * (I * Cos(Radian(Rotation + (I * Diffrence))))),
           Y + (Between * (I * Sin(Radian(Rotation + (I * Diffrence))))), Radius, Colour)
  Next
  
EndProcedure



;Transer_Circle_Angle(X, Y, Between, Radius, Rotation, Angle, Count, Colour)
Procedure Transer_Circle_Angle(X, Y, Between, Radius, Rotation, Angle, Count, Colour)
  
  For I = 1 To Count
    Circle(X + (Between * Cos(Radian(Rotation + (Angle * I/Count)))), 
           Y + (Between * Sin(Radian(Rotation + (Angle * I/Count)))), Radius, Colour)
  Next
  
EndProcedure



;***************************************************************************************************************************

Demo Script:

Code: Select all

;******************************************************************************************************
;* Transer Demo 1.0 ************************************************************************************
;******************************************************************************************************


;Import Transer Lib (*.pbi)
XIncludeFile "Transer.pbi"


;Call Rotation Value
Global Rot.i = 0
Global Wave.i = 0
Global Dir.b = 1

;Call Procedure, called Initialize2D
Procedure Initialize2D()
  
  ;Initialize Sprite
  If InitSprite() = 0
    MessageRequester("Fout!", "Kan Sprites niet initializeren!", #PB_MessageRequester_Info)
    End
  EndIf
  
  ;Initializeer Keyboard
  If InitKeyboard() = 0
    MessageRequester("Fout!", "Kan Keyboard niet Initializeren", #PB_MessageRequester_Info)
    End
  EndIf
  
  ;Open Scherm
  If OpenScreen(800, 600, 32, "") = 0
    MessageRequester("Fout!", "Kan Scherm niet Openen", #PB_MessageRequester_Info)
    End
  EndIf
  
EndProcedure


Initialize2D()





Wave * Dir

Repeat
  
  ;Draw Radian Circles
  ClearScreen(0)
  StartDrawing(ScreenOutput())
  Transer_Circle_Defeult(200, 200, 10, 5, Rot, 10, RGB(255, 0, 0))
  Transer_Circle_Diffrence(200, 400, 10, 5, Rot, 1, 10, RGB(0, 255, 0))
  Transer_Circle_Bow(300, 300, 10, 5, Rot, 20, 10, RGB(255, 0, 255))
  Transer_Circle_Wave(500, 300, 10, 5, Rot, Wave, 10, RGB(255, 255, 0))
  Transer_Circle_Angle(600, 400, 100, 5, Rot, 360, 32, RGB(0, 0, 255))
  StopDrawing()
  FlipBuffers()
  
  ;Set Rotation to + 1
  Rot + 1
  
  Wave + (Dir * 1)
  If Wave <= 0 Or Wave >= 32
    Dir = -Dir
  EndIf
  
  ;Exit the demo
  ExamineKeyboard()
  If KeyboardPushed(#PB_Key_Escape)
    End
  EndIf
  
ForEver

;********************************************************************************************************
Features:
1) Draw Circles on right in an line with rotate it
2) Draw Circles on right in an line with rotate it given it an diffrence value per/circle
3) Draw Circles in an given degrees with rotate it
4) Draw Circles in an wave transformation
5) Draw Circles in an bow
Planned Features 1.1:
1) Draw more Shapes
2) Inner Rotation
Fixed Bugs:
1) StartDrawing..., StopDrawing called in each function...., now you must do call they functions self


This source code is writted by Jamie van Cadsand... you can copy it and paste this in PureBasic...
Version Requered: 5.62..., Jamie

Re: Radial Circle Library

Posted: Fri Aug 24, 2018 10:41 am
by NicTheQuick
I don't get it. What is this even doing? Can you give an example?

Maybe you should consider to translate your language into English with DeepL. Then it would be more easy to understand what you are trying to say. ;-)

Re: Radial Circle Library

Posted: Fri Aug 24, 2018 11:21 am
by Mijikai
I dont really get what this is supposed to do (i also dont see a library anywhere).
However i suggest this -> dont use StartDrawing() / StopDrawing() in every drawing function (unless u have a good reason).

:?:
Image

Re: Radial Circle Library

Posted: Fri Aug 24, 2018 3:42 pm
by JamieVanCadsand
Mijikai wrote:I dont really get what this is supposed to do (i also dont see a library anywhere).
However i suggest this -> dont use StartDrawing() / StopDrawing() in every drawing function (unless u have a good reason).

:?:
Image
My bug is fixed..., now i get also the demo script...,
Jamie.

Re: Radian Lib

Posted: Sat Aug 25, 2018 7:57 am
by DK_PETER
Copyright and no editing "the script".
You do know that this is extremely basic math, right? :wink:

Re: Transer Lib

Posted: Mon Aug 27, 2018 6:51 am
by IceSoft
JamieVanCadsand wrote:...
I get here an simple library, called to draw simple 2d radial circles... with given it an count...
Here is the source code, don't edit them.
...
This source code is writted by Jamie van Cadsand... you can copy it and paste this in PureBasic...
Version Requered: 5.62..., Jamie
@JamieVanCadsand
I see no usubility in this simple library. Any examples? Games? Another ideas for using it?
And why a copyright? For what?

Re: Transer Lib

Posted: Tue Aug 28, 2018 3:09 pm
by bfernhout
Guys....

For the people who do not know who this person is:
Jamie is starter in PureBasic and his learning curve is very slow. He does understand the basic work but not all the way. All things around the gaming is unknown by him. So he was thinking that the copyright was somthing else. I explained it to him and now he under stand. All his work he make is under GNU. And all code he post is free to use. The only thing he want to say, is that when you change something in the code and it will not work anymore. He is not te person to adress to for the mistakes you made in the code. That the idea behind it.

His work he showed here is hard work for him and he is very happy to accomplished a challange like this.
His idea to make it a library is for people who has use for it.

Bart.

Good work Jamie. :lol:

Re: Transer Lib

Posted: Tue Aug 28, 2018 3:40 pm
by wilbert
Thanks for your post Bart.

Jamie, it’s great you want to share something you created.
I know how it feels when something you put effort in is working :)