kagura_core

Core math, camera, input, mesh, animation, and transform contracts for Kagura

moon add mizchi/kagura_core@0.2.0
Download zip
Author
Version
0.2.0
License
Apache-2.0
Last updated
2 months ago
Downloads
97

Dependencies

README

#
FinalScreenDrawer

pub trait FinalScreenDrawer {
fn draw_final_screen(Self, frame : FrameBudget) -> Unit
}

#
Game

pub trait Game {
fn layout(Self, outside : OutsideSize) -> LogicalSize
fn update(Self, input : InputSnapshot) -> EngineTermination?
fn draw(Self, frame : FrameBudget) -> Unit
}

#
EngineTermination

pub enum EngineTermination {
RegularTermination
Fatal(String)
} derive(
Debug
)

#
FixedStepConfig

pub struct FixedStepConfig {
tps : Int
max_updates_per_frame : Int
} derive(
Debug
)

Fixed-step simulation contract. Ebiten refs:
  • internal/clock/clock.go
  • internal/ui/context.go (updateFrameImpl / update count handling)

#
FixedStepState

pub struct FixedStepState {
accumulator_ms : Double
tick : Int
} derive(
Debug
)

Scheduler state carried between frames. Ebiten refs:
  • internal/ui/context.go (tick progression and frame accumulator semantics)

#
FrameBudget

pub struct FrameBudget {
updates : Int
alpha : Double
tick : Int
} derive(
Debug
)

impl Show for FrameBudget

#
GamepadSnapshot

pub struct GamepadSnapshot {
id : Int
axes : Array[Double]
pressed_buttons : Array[Int]
} derive(
Debug
)

#
InputSnapshot

pub struct InputSnapshot {
cursor_x : Double
cursor_y : Double
wheel_x : Double
wheel_y : Double
pressed_keys : Array[Int]
pressed_mouse_buttons : Array[Int]
touches : Array[TouchPoint]
gamepads : Array[GamepadSnapshot]
} derive(
Debug
)

#
LogicalSize

pub struct LogicalSize {
width : Int
height : Int
} derive(
Debug
)

impl Show for LogicalSize

#
NoopGame

pub struct NoopGame {
logical_width : Int
logical_height : Int
}

impl Game for NoopGame

#
OutsideSize

pub struct OutsideSize {
width : Double
height : Double
} derive(
Debug
)

impl Show for OutsideSize

#
RunOptions

pub struct RunOptions {
init_unfocused : Bool
screen_transparent : Bool
screen_cleared_every_frame : Bool
} derive(
Debug
)

impl Show for RunOptions

#
StepResult

pub struct StepResult {
updates : Int
alpha : Double
next_state : FixedStepState
} derive(
Debug
)

Planned updates for one rendered frame. Ebiten refs:
  • run.go (Update / Draw separation)
  • internal/ui/context.go (skip / interpolation flow)
impl Show for StepResult

#
TouchPhase

pub enum TouchPhase {
Began
Moved
Stationary
Ended
Cancelled
} derive(
Debug
)

impl Show for TouchPhase

#
TouchPoint

pub struct TouchPoint {
id : Int
x : Double
y : Double
source : TouchSource
} derive(
Debug
)

impl Show for TouchPoint

#
TouchPointEx

pub struct TouchPointEx {
id : Int
x : Double
y : Double
phase : TouchPhase
pressure : Double
delta_x : Double
delta_y : Double
} derive(
Debug
)

#
TouchSource

pub enum TouchSource {
Direct
Indirect
Mouse
Unknown
} derive(
Debug
)

impl Show for TouchSource

#
default_fixed_step_config

fn default_fixed_step_config() -> FixedStepConfig

#
default_run_options

fn default_run_options() -> RunOptions

#
empty_input_snapshot

fn empty_input_snapshot() -> InputSnapshot

#
initial_fixed_step_state

fn initial_fixed_step_state() -> FixedStepState

#
new_fixed_step_config

fn new_fixed_step_config(tps : Int, max_updates_per_frame : Int) -> FixedStepConfig

#
new_frame_budget

fn new_frame_budget(updates : Int, alpha : Double, tick : Int) -> FrameBudget

#
new_gamepad_snapshot

fn new_gamepad_snapshot(id : Int, axes : Array[Double], pressed_buttons : Array[Int]) -> GamepadSnapshot

#
new_input_snapshot

fn new_input_snapshot(cursor_x : Double, cursor_y : Double, wheel_x : Double, wheel_y : Double, pressed_keys : Array[Int]) -> InputSnapshot

#
new_input_snapshot_full

fn new_input_snapshot_full(cursor_x : Double, cursor_y : Double, wheel_x : Double, wheel_y : Double, pressed_keys : Array[Int], pressed_mouse_buttons : Array[Int], touches : Array[TouchPoint], gamepads : Array[GamepadSnapshot]) -> InputSnapshot

#
new_noop_game

fn new_noop_game(width : Int, height : Int) -> NoopGame

#
new_outside_size

fn new_outside_size(width : Double, height : Double) -> OutsideSize

#
new_run_options

fn new_run_options(init_unfocused? : Bool, screen_transparent? : Bool, screen_cleared_every_frame? : Bool) -> RunOptions

#
new_touch_point

fn new_touch_point(id : Int, x : Double, y : Double) -> TouchPoint

#
new_touch_point_ex

fn new_touch_point_ex(id : Int, x : Double, y : Double, phase : TouchPhase) -> TouchPointEx

#
new_touch_point_ex_full

fn new_touch_point_ex_full(id : Int, x : Double, y : Double, phase : TouchPhase, pressure : Double, delta_x : Double, delta_y : Double) -> TouchPointEx

#
new_touch_point_with_source

fn new_touch_point_with_source(id : Int, x : Double, y : Double, source : TouchSource) -> TouchPoint

#
run_game

fn[T : Game] run_game(game : T, options : RunOptions) -> Unit

#
step_fixed_timestep

fn step_fixed_timestep(state : FixedStepState, elapsed_ms : Double, config : FixedStepConfig) -> StepResult

#
touch_phase_from_int

fn touch_phase_from_int(phase : Int) -> TouchPhase

#
touch_phase_to_int

fn touch_phase_to_int(phase : TouchPhase) -> Int

#
touch_point_from_ex

fn touch_point_from_ex(ex : TouchPointEx) -> TouchPoint

#
touch_source_from_int

fn touch_source_from_int(source : Int) -> TouchSource

#
touch_source_to_int

fn touch_source_to_int(source : TouchSource) -> Int

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io