Skip to content

Add publicly exposed engine's API for C FFI (including C header) #18

Closed as not planned
@lunacys

Description

@lunacys

We plan to write a fully featured client in C#, so we need to create a dynamically linked library with engine's API.
An example is available here.

The API should be in a separate crate named c-api.

Maybe #10 should be done first so the API is asynchronous.

API:

  • Game Settings:
    • Gravity
    • Board
    • Attack
    • Wall Kick Mode
  • Time Manager
    • new()
    • update(delta_seconds)
    • reset()
    • enable()
    • disable()
  • Cell Holder:
    • get_occupied_cell_count()
    • clear()
    • get_row(y)
    • set_row(y, row)
    • move_down(from_y, should_update_cell_count)
    • move_up(should_update_cell_count)
    • get_cell_at(x, y)
    • set_cell_at(x, y, cell)
  • Piece (current piece):
    • get_type()
    • get_cell_type()
    • get_offset_type()
    • get_bounds()
    • get_x() and set_x()
    • get_y() and set_y()
    • rotation_state()
  • Piece Manager:
  • Piece Queue:
  • Board:
    • new(game_settings, wall_kick_data, seed)
    • update(time_mgr)
    • move_left(delta)
    • move_right(delta)
    • rotate(direction)
    • try_hold_piece()
    • get_hold_piece()
    • exec_action(action)
    • hard_drop()
    • soft_drop(delta)
    • push_garbage(amount, messiness)
    • attack(damage)
    • find_nearest_y()
    • reset()
    • enable()
    • disable()
    • get_cell_holder()
    • get_piece_manager()
    • get_current_piece()
    • get_piece_queue()
    • get_layout()
    • get_nearest_y()
    • get_piece_points()
    • get_garbage_queue()
    • get_stats()
    • get_settings()
    • is_dead()

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineEngine-related tasksfeatureA new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions