Creative API Documentation

Introduction

The Creative API is a simple yet powerful Python library for controlling inputs programmatically. It serves as the foundation for all Input Sense products and can be used standalone for creating custom automation scripts, accessibility tools, or research applications.

Note: Creative API is designed to work seamlessly with Helios, 2K Vision, and Aim Engine, allowing you to inject custom input logic into any of these platforms.

Installation

Requirements

  • Python 3.8 or higher
  • Windows, macOS, or Linux
  • pip package manager

Install via pip

Bash
pip install creative-api

Install from source

Bash
git clone https://github.com/inputsense/creative-api.git
cd creative-api
python setup.py install

Quick Start

Get started with Creative API in just a few lines of code:

Python
from creative_api import InputManager

# Initialize the input manager
input_manager = InputManager()

# Simple controller input
input_manager.press_button('A')
input_manager.move_stick('left', x=0.5, y=0.5)

# Mouse and keyboard
input_manager.click(x=100, y=200)
input_manager.type_text("Hello, Creative API!")

# Cleanup
input_manager.cleanup()

Basic Controller Controls

press_button()

Press and release a controller button.

input_manager.press_button(button: str, duration: float = 0.05)
Parameter Type Description
button str Button name (A, B, X, Y, LB, RB, etc.)
duration float Press duration in seconds (default: 0.05)
Python
# Single press
input_manager.press_button('A')

# Long press
input_manager.press_button('X', duration=2.0)

hold_button() / release_button()

Hold or release a button for manual control.

input_manager.hold_button(button: str) input_manager.release_button(button: str)
Python
# Hold multiple buttons
input_manager.hold_button('LT')
input_manager.hold_button('A')
time.sleep(1)
input_manager.release_button('A')
input_manager.release_button('LT')

move_stick()

Move an analog stick to a specific position.

input_manager.move_stick(stick: str, x: float, y: float, duration: float = None)
Parameter Type Description
stick str 'left' or 'right'
x float X-axis value (-1.0 to 1.0)
y float Y-axis value (-1.0 to 1.0)
duration float Optional: Hold duration
Python
# Move and hold
input_manager.move_stick('left', x=1.0, y=0, duration=2.0)

# Smooth circle motion
import math
for angle in range(0, 360, 5):
    x = math.cos(math.radians(angle))
    y = math.sin(math.radians(angle))
    input_manager.move_stick('right', x=x, y=y)
    time.sleep(0.05)

Mouse & Keyboard Controls

Mouse Controls

Python
# Move mouse
input_manager.move_mouse(x=500, y=300)

# Click
input_manager.click(x=500, y=300, button='left')

# Right click
input_manager.click(x=500, y=300, button='right')

# Double click
input_manager.double_click(x=500, y=300)

# Drag
input_manager.drag(start_x=100, start_y=100, end_x=500, end_y=500)

# Scroll
input_manager.scroll(direction='down', amount=5)

Keyboard Controls

Python
# Type text
input_manager.type_text("Hello World!")

# Press key
input_manager.press_key('enter')

# Key combination
input_manager.key_combo(['ctrl', 'c'])

# Hold and release keys
input_manager.hold_key('shift')
input_manager.type_text("UPPERCASE")
input_manager.release_key('shift')

Integration with Other Products

Helios Integration

Python
from creative_api import InputManager
from helios import Vision

input_manager = InputManager()
vision = Vision()

@vision.on_detect('target')
def on_target(detection):
    # Use Creative API for input
    input_manager.move_stick(
        'right', 
        x=detection.offset_x,
        y=detection.offset_y
    )
    input_manager.press_button('RT')

2K Vision Integration

Python
from creative_api import InputManager
from vision2k import SportsVision

input_manager = InputManager()
vision = SportsVision('basketball')

# Auto-shoot on open shot
@vision.on_open_shot
def shoot():
    input_manager.press_button('X')

Aim Engine Integration

Python
from creative_api import InputManager
from aim_engine import Model

input_manager = InputManager()
model = Model.load('accessibility_model')

# Apply model adjustments
adjustments = model.get_input_adjustments()
input_manager.set_sensitivity(
    adjustments['sensitivity']
)

Advanced Usage

Input Profiles

Python
# Create and save profiles
from creative_api import InputProfile

profile = InputProfile("FPS_Profile")
profile.set_stick_deadzone(0.15)
profile.set_trigger_threshold(0.5)
profile.set_button_mapping({
    'jump': 'A',
    'crouch': 'B',
    'reload': 'X'
})
profile.save()

# Load and apply profile
input_manager.load_profile("FPS_Profile")

Macro Recording

Python
# Record a macro
input_manager.start_recording("combo_move")

# Perform actions
input_manager.press_button('X')
time.sleep(0.1)
input_manager.press_button('A')
time.sleep(0.05)
input_manager.hold_button('B', duration=0.5)

input_manager.stop_recording()

# Play back macro
input_manager.play_macro("combo_move")

# Play with custom speed
input_manager.play_macro("combo_move", speed=1.5)

Event System

Python
# Set up event listeners
@input_manager.on_button_press('A')
def on_a_pressed():
    print("A button was pressed!")

@input_manager.on_stick_move('left')
def on_left_stick(x, y):
    print(f"Left stick moved to ({x}, {y})")

# Custom conditions
@input_manager.on_condition(lambda: health < 30)
def low_health_action():
    input_manager.press_button('Y')  # Use healing item

Complete Examples

Accessibility Script

Python
from creative_api import InputManager
import time

class AccessibilityHelper:
    def __init__(self):
        self.input_manager = InputManager()
        self.auto_sprint = True
        self.simplified_controls = True
        
    def enable_auto_sprint(self):
        """Automatically sprint when moving"""
        while self.auto_sprint:
            left_x, left_y = self.input_manager.get_stick_position('left')
            
            # If stick is pushed forward, also hold sprint
            if abs(left_y) > 0.7:
                self.input_manager.hold_button('LS')
            else:
                self.input_manager.release_button('LS')
            
            time.sleep(0.05)
    
    def simplified_combo(self, combo_name):
        """Execute complex combos with single button"""
        combos = {
            'heavy_attack': ['hold:RT:200', 'X', 'Y'],
            'dodge_roll': ['B', 'LS'],
            'special_move': ['hold:LT:100', 'A', 'X', 'B']
        }
        
        if combo_name in combos:
            for action in combos[combo_name]:
                if action.startswith('hold:'):
                    _, button, duration = action.split(':')
                    self.input_manager.hold_button(button, float(duration)/1000)
                else:
                    self.input_manager.press_button(action)
                    time.sleep(0.05)

# Usage
helper = AccessibilityHelper()
helper.simplified_combo('heavy_attack')

Research Data Collection

Python
from creative_api import InputManager, DataLogger
import json
from datetime import datetime

class GameplayRecorder:
    def __init__(self):
        self.input_manager = InputManager()
        self.logger = DataLogger("gameplay_session")
        self.session_data = {
            'start_time': datetime.now().isoformat(),
            'inputs': [],
            'events': []
        }
        
    def start_recording(self):
        # Record all inputs
        @self.input_manager.on_any_input
        def record_input(input_type, input_data):
            self.session_data['inputs'].append({
                'timestamp': datetime.now().isoformat(),
                'type': input_type,
                'data': input_data
            })
        
        # Start session
        self.logger.start_session()
    
    def mark_event(self, event_name, data=None):
        """Mark important game events"""
        self.session_data['events'].append({
            'timestamp': datetime.now().isoformat(),
            'event': event_name,
            'data': data
        })
    
    def save_session(self):
        """Save session data for analysis"""
        self.session_data['end_time'] = datetime.now().isoformat()
        
        with open(f"session_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json", 'w') as f:
            json.dump(self.session_data, f, indent=2)
        
        print(f"Session saved with {len(self.session_data['inputs'])} inputs recorded")

# Usage
recorder = GameplayRecorder()
recorder.start_recording()

# During gameplay
recorder.mark_event("level_start", {"level": 1})
# ... gameplay happens ...
recorder.mark_event("level_complete", {"score": 15000})

recorder.save_session()

Complete API Reference

Full API Documentation: For the complete API reference with all methods, parameters, and advanced features, visit our GitHub repository or join our Discord community.

Core Classes

  • InputManager - Main class for input control
  • InputProfile - Save and load input configurations
  • DataLogger - Record input data for analysis
  • MacroRecorder - Record and playback input sequences
  • EventSystem - Event-driven input handling

Utility Functions

  • calibrate_controller() - Auto-calibrate controller
  • test_inputs() - Test all inputs interactively
  • get_connected_devices() - List available input devices
  • set_global_delay() - Set delay between inputs

Ready to Create?

Start building with Creative API and join our community for support and inspiration