Flutter Gamepad Support

Related tags

Gaming flame_gamepad
Overview

flame_gamepad

Gamepad is only supported on Android at the moment.

Checking if the gamepad is connected

    bool isConnected;
    try {
      isConnected = await FlameGamepad.isGamepadConnected;
    } on PlatformException {
      isConnected = false;
    }

Listening to events

To listen to gamepad events use the 'Flame.gamepad' instance, to add a listener use following snippet.

  var gamepad = FlameGamepad()
    ...setListener((String evtType, String key) {
      print(key)
      if (evtType == GAMEPAD_BUTTON_UP) {
        print('is up')
      } else {
        print('is down')
      }
    });

To check for specific keys use the following constants avaiable flame_gamepad class

GAMEPAD_BUTTON_UP
GAMEPAD_BUTTON_DOWN

GAMEPAD_DPAD_UP
GAMEPAD_DPAD_DOWN
GAMEPAD_DPAD_LEFT
GAMEPAD_DPAD_RIGHT

GAMEPAD_BUTTON_A
GAMEPAD_BUTTON_B
GAMEPAD_BUTTON_X
GAMEPAD_BUTTON_Y

GAMEPAD_BUTTON_L1
GAMEPAD_BUTTON_L2

GAMEPAD_BUTTON_R1
GAMEPAD_BUTTON_R2

GAMEPAD_BUTTON_START
GAMEPAD_BUTTON_SELECT

A functional example can be found here

You might also like...

Watermelon is a game developed using Flutter+Flame+Forge2D. 合成大瓜是使用Flutter+Flame+Forge2D开发的一个开源小游戏(Flutter版合成大西瓜)

Watermelon is a game developed using Flutter+Flame+Forge2D. 合成大瓜是使用Flutter+Flame+Forge2D开发的一个开源小游戏(Flutter版合成大西瓜)

合成大瓜 简介 合成大瓜是使用Flutter+Flame+Forge2D开发的一个开源小游戏。 我在微伞小游戏开发的《合成大西瓜》的基础上将其移植到 Flutter 平台,并添加了以下新特性: 支持自定义背景图 支持重力感应操控 支持修改图片素材 支持反向合成小瓜 支持只生成小/大瓜 内置多套游戏主

Dec 4, 2022

Simple Flappy Bird Game with the most functionalities developed in Flutter

flappy_bird Flutter Game App for Graphics Course Getting Started This project is a starting point for a Flutter application. A few resources to get yo

Jan 8, 2023

Chinese Chess game by Flutter

Chinese Chess game by Flutter

Chinese Chess 中国象棋界面端. 提供完整的游戏规则处理,windows版带elephanteye引擎的招法提示 功能 游戏规则处理。包括落子点提示,将军、应将提示,输赢检测 棋盘棋子皮肤加载 支持PGN格式加载,FEN格式导入 PGN格式导出, FEN格式局面复制 棋谱自动演播 多语言

Dec 20, 2022

An example Flutter app showing how to easily integrate with Flame games

space_burger A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Jun 4, 2021

A simple 2D multiplayer online game built using Flutter and Flame engine

A simple 2D multiplayer online game built using Flutter and Flame engine

Club Penguin Introduction 🚀 Club Penguin A multiplayer game involving penguins and anonymous chat in a virtual 2D world Before we start, you can take

Dec 24, 2022

An application cum Game-based App built using Flutter that compose a mind-tricked word game, Just for fun.

destini_challenge A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you st

Feb 3, 2022

A Flutter RPG Game Engine.

A Flutter RPG Game Engine.

DevilF 游戏引擎 A Flutter RPG Game Engine. 一款使用Flutter开发的RPG游戏引擎。 引擎介绍 (Devil Fighter) 自从有了Flutter,轻松实现了三端跨平台,并且不增加包体积,就能拥有一套Native游戏引擎,为APP游戏化提供了更多可能性。 开

Dec 21, 2022

A Simple TicTacToe Game Built With Flutter

A Simple TicTacToe Game Built With Flutter

A Simple TicTacToe Game Built With Flutter

Jun 30, 2022

Flutter dice game 🎲🔥🎲🔥🎲

Flutter dice game 🎲🔥🎲🔥🎲

Flutter dice game 🎲🔥🎲🔥🎲

Dec 12, 2021
Owner
Flame Engine
2D game engine built on top of Flutter
Flame Engine
Wordle-flutter - A Wordle Game Made With Flutter

wordle with flutter A small wordle made with flutter Getting Started Just a 4 ho

Fernando Souto Gonzalez 9 Dec 11, 2022
Tic-tac-toe-flutter - Multi player TIC-TAC-TOE game made using flutter

tic_tac_toe Multi player TIC-TAC-TOE game made using flutter State Management li

Aakash Pamnani 3 Feb 22, 2022
A minimalist Flutter game engine

A minimalistic Flutter game engine. English | 简体中文 | Polski | Русский About 1.0.0 Our goal is to release v1 soon. We are periodically launching RCs (r

Flame Engine 7.3k Jan 8, 2023
Public repo for flutterflip, a reversi clone built with Flutter.

flutterflip A single-player reversi clone built with Flutter, which compiles for both Android and iOS. The user plays as black, and the CPU will make

Andrew Brogdon 247 Dec 28, 2022
How to build a Match-3 game, like Candy Crush, Bejeweled, FishDom… in Flutter.

flutter_crush How to build a Math-3 game, like Candy Crush, Bejeweled, FishDom… in Flutter. Source code of the article available on didierboelens.com

Didier Boelens 477 Nov 28, 2022
a tetris game powered by flutter. 使用flutter开发俄罗斯方块。

English introduction Please view README_EN Flutter俄罗斯方块 使用Flutter开发的俄罗斯方块游戏。支持 Android, iOS, Windows, mac, Linux 以及 web. 参考来源于 vue-tetris 。 如何开始 自行编译

Bin Yang 1.4k Dec 23, 2022
Party Charades game created in Flutter.

Party Flutter Mobile party game implemented in Flutter framework. Its been heavily inspired by the Heads Up! game: Get a group of friends (at least 3

Kamil Rykowski 181 Nov 6, 2022
Cyberpunk-inspired puzzle game prototype created with Flutter and Flame #Hack20 #FlutterHackathon

Ghost Rigger Prototype of a cyberpunk-inspired puzzle game set in a dystopian future: In the year 2078, the megacorporation Native Development Initiat

Float like a dash Sting like a dart 184 Dec 26, 2022
A game powered by Flutter and Flame

Flutters About Flutters is a demo game powered by Flutter and Flame. I wrote it to test out its performance and gaming capabilities and decided to ope

Florentin / 珞辰 184 Jan 8, 2023
Game RPG build by Flame Flutter

Darkness Dungeon Game developed for the purpose of testing the use of the Bonfire package! Download APK Used packages: Bonfire - Flame - Used sprites:

Rafael Almeida Barbosa 254 Jan 3, 2023