QuoteX_PRINT text#$, x#, y#, z#, scale#, kerning%=FALSE
"Gravity2023.gbas"(754) error : GPC0006 wrong number of aguments : "X_PRINT" called with 6 args. Required: 5 to 5
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuoteX_PRINT text#$, x#, y#, z#, scale#, kerning%=FALSE
// --------------------------------- //
// Project: Vector Object - OOP
// Start: Saturday, August 29, 2015
// Created By: Neil M. Silver
// Code based on the works done by BigSofty and Jestermon.
//
// ======================================================================================== //
// Vector Object - OOP
//
// This is a Vector Library, true OOP style.
// The Vector object can be analised, or transformed with vector math functions.
//
// Note:
// Declare your vectors ahead of time AS VEC3.
// Your main vector is the main object(VecA), and you pass in secondary vectors(VecB) as inputs.
// VecB as an input is always the OTHER secondary vector being analised.
// CrossProduct function outputs VectorOutput AS Vec3 as the output, to preserve the first vector.
//
// LOCAL My3dVector AS VEC3
// My3dVector._INIT_(1.0,1.0,1.0) //not a normalized vector.
// My3dVector._NORMALIZE() //My3dVector length is now normalized to 1 which preserves its original direction, eg ||V|| = 1
// My3dVector._SCALE(2.0) // vector is now length = 2, in its original direction.
//
// LOCAL My3dVector2 AS VEC3
// My3dVector2._INIT_(3.0,-1.0,-2.0) //not a normalized vector.
// LOCAL MyProductOutputVector AS VEC3 // no need to init this one...itll be used for the product results.
// My3dVector._CROSSPRODUCT(My3dVector2, MyProductOutputVector ) //MyProductOutputVector contains the results of this function byref.
//
TYPE VEC3 // 3 dimensional Vector Object
//VecA
vX#
vY#
vZ#
// Initialise Your Vector Object Here.
FUNCTION _INIT_: vX#, vY#, vZ# // LIB VEC3 - Vector Object Input
self.vX# = vX#
self.vY# = vY#
self.vZ# = vZ#
ENDFUNCTION
// Information Analysis function sets:
// DOT Product
// Note, Computers arent reliable calcultating DOT
// IF value is < 0.01 THEN it is really 0!
// I tested many different values in a vector calculator to find this tolerance number.
// That said, this DOT function works really well.
FUNCTION _DOT#: VecB AS VEC3 // LIB VEC3 - Vector DOT Product
LOCAL DOT# = ( (self.vX*VecB.vX) + (self.vY*VecB.vY) + (self.vZ*VecB.vZ) )
IF DOT < 0.01 THEN DOT = 0
RETURN DOT
ENDFUNCTION
// Magnitude
FUNCTION _MAG#: // LIB VEC3 - Vector Magnitude
RETURN SQR( (self.vX*self.vX) + (self.vY*self.vY) + (self.vZ*self.vZ) )
ENDFUNCTION
// Cross Product
// Returns VecOutput with a vector cross product as its value.
FUNCTION _CROSS: VecB AS VEC3, VecOutput AS VEC3 // LIB VEC3 - Cross Product - VecOutput is the output.
VecOutput.vX = (self.vY * VecB.vZ) - (self.vZ * VecB.vY)
VecOutput.vY = (self.vZ * VecB.vX) - (self.vX * VecB.vZ)
VecOutput.vZ = (self.vX * VecB.vY) - (self.vY * VecB.vX)
ENDFUNCTION
// Vector Math Section, These Mutate/Transform/Affect your Vector Object:
// Normalize, Vector Length = 1 (eg. ||V|| = 1)
// You can change the Size of the normal, mutates vector absolute size as the product =D
// This is the same as normalizing your vector then scaling it up!
// Much faster to scale the absolute size here initially, rather than to normailize and then scale up, saves steps.
// If you dont feel comfortable with this, then use the regular vector _SCALAR function after normalizing to 1.
// Leave it as 1.0 for a normal normalization product.
FUNCTION _NORMALIZE: Size# = 1.0 // LIB VEC3 - Normalize the Vector to length = 1.0
LOCAL vLEN# = self._MAG()
self.vX# = self.vX# * ( Size# / vLEN )
self.vY# = self.vY# * ( Size# / vLEN )
self.vZ# = self.vZ# * ( Size# / vLEN )
ENDFUNCTION
FUNCTION _ADD: VecB AS VEC3 // LIB VEC3 - Vector Addition
self.vX = self.vX + VecB.vX
self.vY = self.vY + VecB.vY
self.vZ = self.vZ + VecB.vZ
ENDFUNCTION
FUNCTION _SUBTRACT: VecB AS VEC3 // LIB VEC3 - Vector Subtraction
self.vX = self.vX - VecB.vX
self.vY = self.vY - VecB.vY
self.vZ = self.vZ - VecB.vZ
ENDFUNCTION
FUNCTION _SCALAR: Scale# // LIB VEC3 - Vector Scalar
self.vX = self.vX * Scale
self.vY = self.vY * Scale
self.vZ = self.vZ * Scale
ENDFUNCTION
FUNCTION _INVERT: // LIB VEC3 - Vector Inversion, flip all signs.
self.vX = -self.vX
self.vY = -self.vY
self.vZ = -self.vZ
ENDFUNCTION
ENDTYPE
TYPE lib_SOUND_Object_
SndObj_Name$
SndObj_Path$
SndObj_Buff%
SndObj_Balance%
SndObj_ID%
SndObj_Channel% //internal glbasic channel id
SndObj_Volume#
SndObj_Mute%
SndObj_IS_Playing%
// This sound is an object.
// A sound object is preloaded with independant balance and volume.
// This sounds volume level, can be controlled by a master volume input at playtime.
FUNCTION _SNDOBJ_LOAD: FilePath$, FileName$, NumBuffers%, Balance%// NumBuffers% [1..4], Returns ID%
self.SndObj_Name$ = FileName$
self.SndObj_Path$ = FilePath$
self.SndObj_Buff% = NumBuffers%
self.SndObj_Balance% = Balance%
self.SndObj_ID% = GENSOUND()
LOADSOUND ( self.SndObj_Path$ + self.SndObj_Name$ ), self.SndObj_ID%, self.SndObj_Buff%
RETURN self.SndObj_ID%
ENDFUNCTION
// is this object playing?
FUNCTION _SNDOBJ_ISPLAYING:
self.SndObj_IS_Playing% = SOUNDPLAYING(self.SndObj_Channel%)
RETURN self.SndObj_IS_Playing%
ENDFUNCTION
FUNCTION _SNDOBJ_PLAY: MasterVolume% // [0..1]
self.SndObj_Channel% = PLAYSOUND( self.SndObj_ID%, self.SndObj_Balance%, ( self.SndObj_Volume% * MasterVolume% ))
RETURN self.SndObj_Channel%
ENDFUNCTION
FUNCTION _SNDOBJ_STOP:
HUSH // HUSH(channel%) command requested
RETURN self._SNDOBJ_ISPLAYING()
ENDFUNCTION
ENDTYPE
// --------------------------------- //
// Project: ColorPalette
// Start: Saturday, August 08, 2015
// IDE Version: 12.312
// SETCURRENTDIR("Media") // go to media files
WHILE TRUE
ColorPalette(10,10,64)
SHOWSCREEN
WEND
FUNCTION ColorPalette: x%, y%, BlockWidth%
LOCAL ColorBandColumnID%, xx%
ColorBandColumnID% = 0
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + (BlockWidth% * i%)
LOCAL cbC% = (255-(i% * 32))
LOCAL Color# = RGB( cbC%, 0, 0 )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 1
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCR% = ( 255 - ( i% * 32 ) )
LOCAL cbCG% = ( 128 - ( i% * 16 ) )
LOCAL Color# = RGB( cbCR%, cbCG%, 0 )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 2
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCR% = ( 255 - ( i% * 32 ) )
LOCAL cbCG% = ( 255 - ( i% * 32 ) )
LOCAL Color# = RGB( cbCR%, cbCG%, 0 )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 3
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCR% = ( 128 - ( i% * 16 ) )
LOCAL cbCG% = ( 255 - ( i% * 32 ) )
LOCAL Color# = RGB( cbCR%, cbCG%, 0 )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 4
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCG% = ( 255 - ( i% * 32 ) )
LOCAL Color# = RGB( 0, cbCG%, 0 )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 5
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCG% = ( 255 - ( i% * 32 ) )
LOCAL cbCB% = ( 128 - ( i% * 16 ) )
LOCAL Color# = RGB( 0 ,cbCG%, cbCB%)
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 6
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCG% = ( 255 - ( i% * 32 ) )
LOCAL cbCB% = ( 255 - ( i% * 32 ) )
LOCAL Color# = RGB( 0, cbCG%, cbCB% )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 7
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCG% = ( 128 - ( i% * 16 ) )
LOCAL cbCB% = ( 255 - ( i% * 32 ) )
LOCAL Color# = RGB( 0, cbCG%, cbCB% )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 8
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCB% = ( 255 - ( i% * 32 ) )
LOCAL Color# = RGB( 0, 0, cbCB% )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 9
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCB% = ( 255 - ( i% * 32 ) )
LOCAL cbCR% = ( 128 - ( i% * 16 ) )
LOCAL Color# = RGB( cbCR%, 0, cbCB% )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 10
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCB% = ( 255 - ( i% * 32 ) )
LOCAL cbCR% = ( 255 - ( i% * 32 ) )
LOCAL Color# = RGB( cbCR%, 0, cbCB% )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
ColorBandColumnID% = 11
xx% = ( x% + (BlockWidth% * ColorBandColumnID% ) )
FOR i% = 0 TO 7
LOCAL cby% = y% + ( BlockWidth% * i% )
LOCAL cbCB% = ( 128 - ( i% * 16 ) )
LOCAL cbCR% = ( 0xff - ( i% * 0x24 ) )
LOCAL Color# = RGB( cbCR%, 0, cbCB% )
ColorBlock( xx%, cby%, Color#, BlockWidth% )
NEXT
RETURN 0
ENDFUNCTION
FUNCTION ColorBlock: x#,y#, color#, size%
DRAWRECT x,y,size%,size%,color#+ RGB(RND(32), RND(32), RND(32))
RETURN 0
ENDFUNCTION
Quote
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.10.053 SN:17b922e3 - 3D, NET
Wordcount:1334 commands
compiling:
C:\Users\A10TRI~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Users\A10TRI~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp:794: error: no matching function for call to `GETDESKTOPSIZE(DGInt&, DGNat&)'
C:/Program Files (x86)/GLBasic_v12/Compiler/platform/Include/glb.h:1369: note: candidates are: void __GLBASIC__::GETDESKTOPSIZE(DGInt&, DGInt&)
C:/Program Files (x86)/GLBasic_v12/Compiler/platform/Include/glb.h:1370: note: void __GLBASIC__::GETDESKTOPSIZE(DGNat&, DGNat&)
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 3.0 sec. Time: 01:44
Build: 0 succeeded.
*** 1 FAILED ***
// Color Override - Fluxuator
STATIC ColorRotator% = 0 , ColorWheel% = 1
LOCAL Circulartime = 2.777777778 // = 1000/360, one second of time divided by 360. Divide gettimer() with this, and accumulate the value every loop, and you get 360 degrees rotating every second.
ColorRotator = (GETTIMER()/Circulartime) + ColorRotator
IF ColorRotator > 359 THEN ColorRotator = 0
ColorWheel = INTEGER((SIN(ColorRotator) * 127) + 128)
Color = RGB(ColorWheel,ColorWheel,ColorWheel)