Jump to content

Unified Get/Set Accessors


TylerH
 Share

Recommended Posts

I am mainly consolidating some existing requests by Masterxilo, combined with some requests of mine because these are 100% crucial to having a fully OO wrapper and framework for Leadwerks. These should have been in from the beginning, and are trivial to add (I could add them to the DLL source in a few hours).

 

These are the functions that need added (alphabetical by class):

  • Body
  • GetBodyGravityMode
  • GetBodyDamping
  • GetBodyMassCenter
  • GetBodyElasticity
  • GetBodySoftness
  • GetBodyFriction
  • GetBodyBuoyancyMode
  • GetBodyStepMode
  • GetBodyTorque
  • GetBodyForce
  • Camera
  • GetCameraClearColor
  • GetCameraProjMode
  • GetCameraZoom
  • GetCameraClearMode
  • Corona
  • GetCoronaRadius
  • Emitter
  • GetEmitterVelocity
  • GetEmitterAcceleration
  • GetEmitterArea
  • GetEmitterRadius
  • GetEmitterRotationSpeed
  • GetEmitterWaver
  • GetEmitterCycleMode (this is set in the constructor)
  • GetEmitterLifeTime (this is set in the constructor)
  • SetEmitterLifeTime (would be nice to be able to change this after creation)
  • Entity
  • GetEntityColor
  • GetEntityViewRange
  • GetEntityOcclusionMode
  • GetEntityShadowRange
  • GetEntityShadowMode
  • SetEntityQuat (this would make IK much more efficient)
  • Joint
  • GetHingeJointLimits
  • GetSliderJointLimits
  • GetBallJointLimits
  • GetJointStiffness
  • GetJointCollisionMode
  • Light
  • GetLightFalloff
  • GetLightConeAngles
  • GetShadowmapSize
  • GetShadowOffset
  • GetShadowSoftness
  • GetShadowDistance
  • Shader
  • GetShaderXXX (for all SetShaderXXX commands)
  • Source
  • GetSourceVolume
  • GetSourcePitch
  • GetSourceRange
  • GetSourcePosition
  • Terrain
  • GetTerrainTexture
  • GetTerrainTextureScale
  • GetTerrainTextureRotation
  • GetTerrainMappingMode
  • GetTerrainTextureConstraints
  • Vehicle
  • SetTireMatrix
  • World
  • GetPhysicsQuality
  • GetWorldGravity
  • GetWorldSize
  • GetFluidPlane
  • GetFluidViscosity
  • GetFluidDensity
  • GetEntities
  • GetMeshes
  • GetModels
  • GetEmitters
  • GetTerrains
  • GetCoronas
  • GetBodies
  • GetListeners
  • GetCameras
  • GetPivots
  • GetJoints
  • GetControllers
     

  • Upvote 2

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

I agree with this completely.

 

Get and Set are clear and easy to understand.

and impossible to misunderstand.

 

When I wrote LEO I did follow the Get/Set notation

and was back then amazed that this simple set of rule

was not implemented from start.

AV MX Linux

Link to comment
Share on other sites

100% support this request. But I'm not quite sure whether the commands should start with Get/Set in the c api...

 

BodyGet... and TerrainGet... would be easier to find by "accident" when learning the commandset by looking trough intellisense. That syntax would be more similar to the oop terrain.Get...();

 

But yes, those functions are really needed.

Link to comment
Share on other sites

Generally in OOP, the method name should always start with a verb, followed by the object.

 

Get/Set are good where things are really getted and setted, those are usually values.

Other good verbs are Turn, Rotate, Flip, Render, Update, Scale, Load, Save, etc...

 

The only exception to using verb as first word are prepositions, which are used to get boolean values, like Is, Has, Can, May, etc...

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I would add the following categories:

 

  • Gets in the framework, extremely useful for option dialogs (effects, etc).
  • Gets in the graphics, extremely useful for option dialogs (resizing, etc).

 

I know it is possible for me to store whether effect X has been enabled, and keep that variable, but it is theoretically bad practice as such value could be changed without my application getting notified, leading to unexpected behavior.

 

It is only expectable to have a get where you have a set, and vice versa.

 

  • Framework
  • GetStats
  • GetZoom
  • GetSaturation
  • GetBrightness
  • GetContrast
  • GetAntialias
  • GetSSAO
  • GetGodRays
  • GetHDR
  • GetBloom
  • GetWater
  • GetWaterAmplitude
  • GetReflectionElements
  • GetWaterVisibility
  • GetWaterSoftness
  • GetWaterColor
  • GetWaterHeight
  • GetWaterWaveSpeed
  • GetDistanceFog
  • GetDistanceFogColor
  • GetDistanceFogAngle
  • GetDistanceForRange
  • GetBackgroundMode
  • GetBackgroundColor
  • GetSkybox
  • GetNearDOF
  • GetNearDOFStrength
  • GetNearDOFRange
  • GetFarDOF
  • GetFarDOFStrength
  • GetFarDOFRange
  • Graphics
  • GetWireframe
  • GetOcclusionCulling
  • GetHertz
  • GetFlags
  • GetDepth

Link to comment
Share on other sites

  • 1 month later...

All of these and more have been implemented in our custom engine DLL.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...