` markup. */ function openstation_inkfall_icon_svg() { return '' . '' . '' . '' . '' . '' . '' . ''; } /** * Register Inkfall with the games registry on `init`. * * Priority 20 — alongside the Games window registration. */ function openstation_inkfall_register() { if ( ! function_exists( 'openstation_games_user_can_use' ) || ! openstation_games_user_can_use() ) { return; } openstation_register_game( 'inkfall', array( 'title' => __( 'Inkfall', 'desktop-mode' ), 'description' => __( 'Words fall down a notebook page — type them before they reach the bottom. Finishing a word sends up a musical note that tears it into scattering letters.', 'desktop-mode' ), 'icon_svg' => openstation_inkfall_icon_svg(), 'script' => 'os-game-inkfall', // Mirrors the `window` block in `src/games/inkfall/index.ts`. // Declared here as well so the window opens at the right // size on the very first play, before the bundle that // carries the def has been fetched. Keep the two in step. 'window' => array( 'width' => 820, 'height' => 620, 'minWidth' => 520, 'minHeight' => 420, ), 'score_columns' => array( array( 'key' => 'score', 'label' => __( 'Score', 'desktop-mode' ), 'type' => 'number', ), array( 'key' => 'mode', 'label' => __( 'Difficulty', 'desktop-mode' ), 'type' => 'text', ), array( 'key' => 'words', 'label' => __( 'Words', 'desktop-mode' ), 'type' => 'number', ), array( 'key' => 'wpm', 'label' => __( 'WPM', 'desktop-mode' ), 'type' => 'number', ), array( 'key' => 'accuracy', 'label' => __( 'Accuracy', 'desktop-mode' ), 'type' => 'number', ), array( 'key' => 'time', 'label' => __( 'Time', 'desktop-mode' ), 'type' => 'time', ), array( 'key' => 'level', 'label' => __( 'Level', 'desktop-mode' ), 'type' => 'number', ), ), // The dictionary URL arrives via the framework-injected // `wordsUrl` config key (see includes/games/config.php). ) ); } add_action( 'init', 'openstation_inkfall_register', 20 ); /** * Ride the Inkfall window styles on the Games window as a companion. * * The game's script is lazily loaded by the framework on first * launch, and every launch goes through the games bundle — so a * sheet travelling with that bundle is in the tab before the game * window paints, without costing every admin page that never plays. * * @param array $window_args Args passed to `openstation_register_window()`. * @return array */ function openstation_inkfall_window_styles( $window_args ) { if ( ! is_array( $window_args ) ) { return $window_args; } $window_args['styles'] = isset( $window_args['styles'] ) ? (array) $window_args['styles'] : array(); $window_args['styles'][] = 'os-game-inkfall'; return $window_args; } add_filter( 'openstation_games_window_args', 'openstation_inkfall_window_styles' );