Epok Engine

EPOK RUNTIME

epok::pick_2d

Function · 1 overload

Function

Topmost entry under a screen point (highest draw key wins; ties go to the lowest index, which keeps the result stable).

Belongs to
epok
Header
world2d.hpp
Overloads
1

Declaration

Declaration
inline bool pick_2d(const Camera2D& camera, const Fixed* screen_xy, const Pick2DEntry* entries, size_t count, size_t& out_index)

Topmost entry under a screen point (highest draw key wins; ties go to the lowest index, which keeps the result stable).

ParameterTypeMeaning
cameraconst Camera2D &Value supplied for camera. Keep referenced or pointed-to data valid for the complete call.
screen_xyconst Fixed *Value supplied for screen_xy. Keep referenced or pointed-to data valid for the complete call.
entriesconst Pick2DEntry *Value supplied for entries. Keep referenced or pointed-to data valid for the complete call.
countsize_tValue supplied for count. Keep referenced or pointed-to data valid for the complete call.
out_indexsize_t &Value supplied for out_index. Keep referenced or pointed-to data valid for the complete call.

Returns: bool. Check the value before continuing when it represents success, availability or a resource handle.

Example

C++ example
#include "world2d.hpp"

// Assume these named values have been initialized with valid data:
// const Camera2D & camera
// const Fixed * screen_xy
// const Pick2DEntry * entries
// size_t count
// size_t & out_index

auto result = epok::pick_2d(camera, screen_xy, entries, count, out_index);

Why use it

The boolean result makes success, availability or state explicit without exceptions.

Trade-offs and warnings

Check the return value; `false` is part of normal control flow for many PSX resource operations. Pointer/reference arguments are borrowed unless the source contract says otherwise; keep them valid for the complete operation and never assume null is accepted.

Declared in runtime/world2d.hpp:652

Related members