kagura_core

    Portable calculations and data: input, timing, physics, terrain and procedural geometry

    Download zip
    Author
    Version
    0.6.0
    License
    Apache-2.0
    Last updated
    15 days ago
    Downloads
    129

    #mizchi/kagura_core

    ホストや描画から独立した計算・データの層です。入力スナップショット、固定 timestep、 階層、地形・メッシュ生成を持ちます。値・状態・seed を受け取り、結果を返すか 呼び出し元の状態を更新します。GPU リソースやブラウザ/OS FFI は持ちません。

    geom、mesh3d、anim3d(骨格・IK)、pathfind は独立 module です。 physics2d、physics3d、collision3d、terrain3d、procedural3d はこの module の package です。 packing2d は矩形配置、particle3d は粒子の生成・運動・寿命、statistics は数値集計を担当します。 再生時間の Timeline は独立 module 内の anim3d/playback にあり、2D・3D・Web ビューアで共有します。

    描画 callback と実行オプションは mizchi/kagura_engine/application を使用します。 共通入力型は mizchi/kagura_core、押下差分と押下時間は core/inputstate。 WASD の移動・決定などの割り当てと InputHelper は game/inpututil が所有します。

    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)

    FixedStepConfig::output

    fn FixedStepConfig::output(self : FixedStepConfig, logger : &Logger) -> Unit

    FixedStepConfig::to_string

    fn FixedStepConfig::to_string(self : FixedStepConfig) -> String

    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)

    FixedStepState::output

    fn FixedStepState::output(self : FixedStepState, logger : &Logger) -> Unit

    FixedStepState::to_string

    fn FixedStepState::to_string(self : FixedStepState) -> String

    FrameBudget

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

    impl Show for FrameBudget

    FrameBudget::output

    fn FrameBudget::output(self : FrameBudget, logger : &Logger) -> Unit

    FrameBudget::to_string

    fn FrameBudget::to_string(self : FrameBudget) -> String

    GamepadSnapshot

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

    GamepadSnapshot::output

    fn GamepadSnapshot::output(self : GamepadSnapshot, logger : &Logger) -> Unit

    GamepadSnapshot::to_string

    fn GamepadSnapshot::to_string(self : GamepadSnapshot) -> String

    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
    )

    InputSnapshot::output

    fn InputSnapshot::output(self : InputSnapshot, logger : &Logger) -> Unit

    InputSnapshot::to_string

    fn InputSnapshot::to_string(self : InputSnapshot) -> String

    LogicalSize

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

    impl Show for LogicalSize

    LogicalSize::output

    fn LogicalSize::output(self : LogicalSize, logger : &Logger) -> Unit

    LogicalSize::to_string

    fn LogicalSize::to_string(self : LogicalSize) -> String

    OutsideSize

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

    impl Show for OutsideSize

    OutsideSize::output

    fn OutsideSize::output(self : OutsideSize, logger : &Logger) -> Unit

    OutsideSize::to_string

    fn OutsideSize::to_string(self : OutsideSize) -> String

    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

    StepResult::output

    fn StepResult::output(self : StepResult, logger : &Logger) -> Unit

    StepResult::to_string

    fn StepResult::to_string(self : StepResult) -> String

    TouchPhase

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

    impl Show for TouchPhase

    TouchPhase::output

    fn TouchPhase::output(self : TouchPhase, logger : &Logger) -> Unit

    TouchPhase::to_string

    fn TouchPhase::to_string(self : TouchPhase) -> String

    TouchPoint

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

    impl Show for TouchPoint

    TouchPoint::output

    fn TouchPoint::output(self : TouchPoint, logger : &Logger) -> Unit

    TouchPoint::to_string

    fn TouchPoint::to_string(self : TouchPoint) -> String

    TouchPointEx

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

    TouchPointEx::output

    fn TouchPointEx::output(self : TouchPointEx, logger : &Logger) -> Unit

    TouchPointEx::to_string

    fn TouchPointEx::to_string(self : TouchPointEx) -> String

    TouchSource

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

    impl Show for TouchSource

    TouchSource::output

    fn TouchSource::output(self : TouchSource, logger : &Logger) -> Unit

    TouchSource::to_string

    fn TouchSource::to_string(self : TouchSource) -> String

    default_fixed_step_config

    fn default_fixed_step_config() -> FixedStepConfig

    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_logical_size

    fn new_logical_size(width : Int, height : Int) -> LogicalSize

    new_outside_size

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

    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

    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