Skip to content

Class: MockDevice ​

Mock of the X-Ray engine device() singleton for jest/node.

Implements ​

  • render_device

Constructors ​

Constructor ​

ts
new MockDevice(): MockDevice;

Returns ​

MockDevice

Methods ​

create() ​

ts
static create(): MockDevice;

Returns ​

MockDevice


getInstance() ​

ts
static getInstance(): MockDevice;

Returns ​

MockDevice


mock() ​

ts
static mock(): render_device;

Returns ​

render_device

Properties ​

aspect_ratio ​

ts
aspect_ratio: number;

Current viewport aspect ratio.

Implementation of ​

ts
render_device.aspect_ratio

cam_dir ​

ts
cam_dir: vector;

Camera forward direction.

Implementation of ​

ts
render_device.cam_dir

cam_pos ​

ts
cam_pos: vector;

Camera world position.

Implementation of ​

ts
render_device.cam_pos

cam_right ​

ts
cam_right: vector;

Camera right direction.

Implementation of ​

ts
render_device.cam_right

cam_top ​

ts
cam_top: vector;

Camera up direction.

Implementation of ​

ts
render_device.cam_top

f_time_delta ​

ts
f_time_delta: number = 0;

Last frame time delta in seconds.

Remarks ​

This value is 0 while the game timer is paused.

Implementation of ​

ts
render_device.f_time_delta

fov ​

ts
fov: number = 70;

Current field of view.

Implementation of ​

ts
render_device.fov

frame ​

ts
frame: number = 0;

Current render frame number.

Implementation of ​

ts
render_device.frame

globalTime ​

ts
globalTime: number = 0;

height ​

ts
height: number = 1080;

Backbuffer height in pixels.

Implementation of ​

ts
render_device.height

is_paused ​

ts
is_paused: Mock<() => boolean>;

Check whether the render device is paused.

Returns ​

Whether game rendering is paused.

Implementation of ​

ts
render_device.is_paused

isPaused ​

ts
isPaused: boolean = false;

pause ​

ts
pause: Mock<(paused: boolean) => void>;

Change game pause state.

Remarks ​

Pauses the game timer but not sound emitters. Dedicated servers and benchmark mode ignore pause requests.

Param ​

paused

Whether the game should be paused.

Implementation of ​

ts
render_device.pause

precache_frame ​

ts
precache_frame: number = 0;

Remaining precache frame count.

Implementation of ​

ts
render_device.precache_frame

time_delta ​

ts
time_delta: number = 0;

Last frame time delta in milliseconds.

Remarks ​

This value is 0 while the game timer is paused.

Implementation of ​

ts
render_device.time_delta

time_global ​

ts
time_global: Mock<() => number>;

Get current game timestamp.

Remarks ​

Reads the frame-updated Device.dwTimeGlobal value.

Example ​

ts
`29319`, `46297`

Returns ​

Milliseconds from game start.

Implementation of ​

ts
render_device.time_global

width ​

ts
width: number = 1920;

Backbuffer width in pixels.

Implementation of ​

ts
render_device.width

instance ​

ts
protected static instance: MockDevice | null = null;