Skip to main content

C_Probe

Probe component for dynamic indicators and effects.

Represents small probes, particles, or indicators that can move freely in space, show status information, or create visual effects like particle trails, scanners, or data flows.


Namespace: enjin2

Header: include/enjin2/components/probe.hpp

Public Methods

C_Probe(Object *owner, ProbeType type=ProbeType::DOT, float size=2.0f)

Constructor.

ownerOwner object typeProbe visual type sizeProbe size


virtual void update(float dt) override

Update probe movement and animation.

dtTime elapsed since last update in seconds


virtual void draw(ICanvas< Pixel4 > &canvas) override

Draw probe to 4-bit canvas.

canvasTarget 4-bit canvas


void setAppearance(ProbeType type, float size, Pixel4 color, Pixel4 accent=Pixel4(10))

Set probe appearance.

typeVisual type of probe sizeProbe size in pixels colorPrimary probe color accentSecondary accent color


void setMovement(MovementPattern pattern, float speed=1.0f)

Set movement pattern.

patternMovement pattern type speedMovement speed multiplier


void setVelocity(Point vel)

Set linear velocity (for LINEAR movement)

velVelocity vector


void setPulsing(bool enabled, float speed=2.0f)

Enable pulsing effect.

enabledTrue to enable pulsing speedPulse frequency multiplier


void setTrail(bool enabled)

Enable particle trail.

enabledTrue to enable trail rendering


void setMovementBounds(const Rect &bounds, bool constrain=true)

Set movement bounds.

boundsBounding rectangle for movement constrainTrue to constrain movement within bounds


void setScanner(float radius, float speed=1.0f)

Set scanner properties (for SCANNER type)

radiusScan beam radius speedScan rotation speed


Private Methods

void updateMovement(float dt)

Update movement based on pattern.


void updateTrail(Point newPoint)

Update trail points.


void drawTrail(ICanvas< PixelType > &canvas)

Draw trail.


void drawDot(ICanvas< PixelType > &canvas, Point center, float size, PixelType color)

Draw different probe shapes.


void drawDiamond(ICanvas< PixelType > &canvas, Point center, float size, PixelType color)


void drawCross(ICanvas< PixelType > &canvas, Point center, float size, PixelType color)


void drawTriangle(ICanvas< PixelType > &canvas, Point center, float size, PixelType color)


void drawScanner(ICanvas< PixelType > &canvas, Point center, float size, PixelType color)


void drawParticle(ICanvas< PixelType > &canvas, Point center, float size, PixelType color)


void drawLine(ICanvas< PixelType > &canvas, Point from, Point to, PixelType color)