Linux下使用游戏手柄

2023-05-16

大多数情况下,Linux系统都带有手柄驱动模块joydev,当我们插上设备的时候可以通过以下指令查看是否检测到该设备

ls /dev/    或者    ls /dev/input/

如果有出现 js0 的设备,则证明设备能正常使用


如果没有 js0 设备,可以通过以下指令安装驱动

sudo modprobe joydev

如果提示没有找到该模块则是内核中没有添加该驱动,需手动加载驱动进内核。

正常使用手柄后我们可以使用 joystick 软件来进行测试,使用以下指令进行安装

sudo apt-get install joystick

安装完后,启动软件进行测试

jstest /dev/js0    或者    jstest /dev/input/js0


以上是使用软件进行游戏手柄的测试,在更多时候我们是需要其输出相关信息,下面介绍使用程序将游戏手柄的数据输出:

因为Linux中的list.h不能直接用,所以我们把它单独提出来,建立一个listop.c文件和listop.h文件

/*listop.c*/
#include "listop.h"   
  
  
static  void __check_head(struct list_head* head)  
{  
    if ((head->next == 0) && (head->prev == 0)) {  
        INIT_LIST_HEAD(head);  
    }  
}  
  
/* 
 * Insert a new entry between two known consecutive entries. 
 * 
 * This is only for internal list manipulation where we know 
 * the prev/next entries already! 
 */  
static  void __list_add(struct list_head* new,  
                        struct list_head* prev,  
                        struct list_head* next)  
{  
  
    next->prev = new;  
    new->next = next;  
    new->prev = prev;  
    prev->next = new;  
  
}  
  
  
/* 
 * Delete a list entry by making the prev/next entries 
 * point to each other. 
 * 
 * This is only for internal list manipulation where we know 
 * the prev/next entries already! 
 */  
static  void __list_del(struct list_head* prev,  
                        struct list_head* next)  
{  
  
    next->prev = prev;  
    prev->next = next;  
}  
  
  
  
/** 
 * list_add - add a new entry 
 * @new: new entry to be added 
 * @head: list head to add it after 
 * 
 * Insert a new entry after the specified head. 
 * This is good for implementing stacks. 
 */  
void list_add(struct list_head* new, struct list_head* head)  
{  
    __check_head(head);  
    __list_add(new, head, head->next);  
}  
  
/** 
 * list_add_tail - add a new entry 
 * @new: new entry to be added 
 * @head: list head to add it before 
 * 
 * Insert a new entry before the specified head. 
 * This is useful for implementing queues. 
 */  
void list_add_tail(struct list_head* new, struct list_head* head)  
{  
    __check_head(head);  
    __list_add(new, head->prev, head);  
}  
  
  
/** 
 * list_del - deletes entry from list. 
 * @entry: the element to delete from the list. 
 * Note: list_empty on entry does not return true after this, the entry is in an undefined state. 
 */  
void list_del(struct list_head* entry)  
{  
    __list_del(entry->prev, entry->next);  
}  
  
/** 
 * list_del_init - deletes entry from list and reinitialize it. 
 * @entry: the element to delete from the list. 
 */  
void list_del_init(struct list_head* entry)  
{  
    __list_del(entry->prev, entry->next);  
    INIT_LIST_HEAD(entry);  
}  
  
/** 
 * list_move - delete from one list and add as another's head 
 * @list: the entry to move 
 * @head: the head that will precede our entry 
 */  
void list_move(struct list_head* list, struct list_head* head)  
{  
    __check_head(head);  
    __list_del(list->prev, list->next);  
    list_add(list, head);  
}  
  
/** 
 * list_move_tail - delete from one list and add as another's tail 
 * @list: the entry to move 
 * @head: the head that will follow our entry 
 */  
void list_move_tail(struct list_head* list,  
                    struct list_head* head)  
{  
    __check_head(head);  
    __list_del(list->prev, list->next);  
    list_add_tail(list, head);  
}  
  
  
/** 
 * list_splice - join two lists 
 * @list: the new list to add. 
 * @head: the place to add it in the first list. 
 */  
void list_splice(struct list_head* list, struct list_head* head)  
{  
    struct list_head* first = list;  
    struct list_head* last  = list->prev;  
    struct list_head* at    = head->next;  
  
    first->prev = head;  
    head->next  = first;  
  
    last->next = at;  
    at->prev   = last;  
}  
  
struct list_head* list_dequeue( struct list_head* list ) {  
    struct list_head* next, *prev, *result = ((void*)0);  
  
    prev = list;  
    next = prev->next;  
  
    if ( next != prev ) {  
        result = next;  
        next = next->next;  
        next->prev = prev;  
        prev->next = next;  
        result->prev = result->next = result;  
    }  
  
    return result;  
}  
/*listop.h*/
#ifndef LISTOP_H   
#define LISTOP_H   
 

#ifdef __cplusplus
extern "C"
#endif

 
struct list_head {  
    struct list_head *next, *prev;  
};  
  
typedef struct list_head list_t;  
  
#define LIST_HEAD_INIT(name) { &(name), &(name) }   
  
#define LIST_HEAD(name)		struct list_head name = LIST_HEAD_INIT(name)  
  
#define INIT_LIST_HEAD(ptr) do {  (ptr)->next = (ptr); (ptr)->prev = (ptr); } while (0)  
  
/** 
 * list_add - add a new entry 
 * @new: new entry to be added 
 * @head: list head to add it after 
 * 
 * Insert a new entry after the specified head. 
 * This is good for implementing stacks. 
 */  
void list_add(struct list_head *new, struct list_head *head);  
  
/** 
 * list_add_tail - add a new entry 
 * @new: new entry to be added 
 * @head: list head to add it before 
 * 
 * Insert a new entry before the specified head. 
 * This is useful for implementing queues. 
 */  
void list_add_tail(struct list_head *new, struct list_head *head);  
  
  
/** 
 * list_del - deletes entry from list. 
 * @entry: the element to delete from the list. 
 * Note: list_empty on entry does not return true after this, the entry is in an undefined state. 
 */  
void list_del(struct list_head *entry);  
  
/** 
 * list_del_init - deletes entry from list and reinitialize it. 
 * @entry: the element to delete from the list. 
 */  
void list_del_init(struct list_head *entry);  
  
  
/** 
 * list_move - delete from one list and add as another's head 
 * @list: the entry to move 
 * @head: the head that will precede our entry 
 */  
void list_move(struct list_head *list, struct list_head *head);  
  
  
/** 
 * list_move_tail - delete from one list and add as another's tail 
 * @list: the entry to move 
 * @head: the head that will follow our entry 
 */  
void list_move_tail(struct list_head *list,  
                  struct list_head *head);  
  
/** 
 * list_splice - join two lists 
 * @list: the new list to add. 
 * @head: the place to add it in the first list. 
 */  
void list_splice(struct list_head *list, struct list_head *head);  
  
/** 
 * list_empty - tests whether a list is empty 
 * @head: the list to test. 
 */  
static int list_empty(struct list_head *head)  
{  
    return head->next == head;  
}  
  
/** 
 * list_dequeue - dequeue the head of the list if there are more than one entry 
 * @list: the list to dequeue 
 */  
struct list_head * list_dequeue( struct list_head *list );  
  
/** 
 * list_entry - get the struct for this entry 
 * @ptr:    the &struct list_head pointer. 
 * @type:   the type of the struct this is embedded in. 
 * @member: the name of the list_struct within the struct. 
 */  
#define list_entry(ptr, type, member)	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))  
  
/** 
 * list_for_each    -   iterate over a list 
 * @pos:    the &struct list_head to use as a loop counter. 
 * @head:   the head for your list. 
 */  
#define list_for_each(pos, head)	for (pos = (head)->next; pos != (head); pos = pos->next)  
              
/** 
 * list_for_each_safe   -   iterate over a list safe against removal of list entry 
 * @pos:    the &struct list_head to use as a loop counter. 
 * @n:      another &struct list_head to use as temporary storage 
 * @head:   the head for your list. 
 */  
#define list_for_each_safe(pos, n, head)	for (pos = (head)->next, n = pos->next; pos != (head);  pos = n, n = pos->next)  
  
/** 
 * list_for_each_prev   -   iterate over a list in reverse order 
 * @pos:    the &struct list_head to use as a loop counter. 
 * @head:   the head for your list. 
 */  
#define list_for_each_prev(pos, head)	for (pos = (head)->prev; pos != (head); pos = pos->prev)  
              
/** 
 * list_for_each_entry  -   iterate over list of given type 
 * @pos:    the type * to use as a loop counter. 
 * @head:   the head for your list. 
 * @member: the name of the list_struct within the struct. 
 */  
#define list_for_each_entry(pos, head, member)              for (pos = list_entry((head)->next, typeof(*pos), member);   &pos->member != (head);    pos = list_entry(pos->member.next, typeof(*pos), member))  
  
#endif  

以下是执行程序

/*joystick.c*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <linux/joystick.h>
#include "listop.h"
#include "Recv.h"



#if 1
#define LOG_DBG(fmt, ...)  fprintf(stdout, fmt, ##__VA_ARGS__)
#else
#define LOG_DBG(fmt, ...)
#endif

#define LOG_ERR(fmt, ...)  fprintf(stderr, fmt, ##__VA_ARGS__)


typedef struct _joy_stick_ctx {
    struct list_head list;
    int i4_js_fd;
    unsigned int i4_op_block;
} JOYSTICK_CTX_T;

LIST_HEAD(_t_js_ctx_head);
/*==>  struct list_head _t_js_ctx_head = {&_t_js_ctx_head, &_t_js_ctx_head};*/

int joystick_open(char* cp_js_dev_name, int i4_block)
{
    int i4_open_flags = O_RDONLY;
    JOYSTICK_CTX_T*  pt_joystick_ctx = NULL;

    if (!cp_js_dev_name) {
        LOG_ERR("[%s] js device name is NULL\n", __func__);
        return -1;
    }

    pt_joystick_ctx = (JOYSTICK_CTX_T*)calloc(sizeof(JOYSTICK_CTX_T), 1);
    if (!pt_joystick_ctx) {
        LOG_ERR("[%s] no memory!!\n", __func__);
        return -1;
    }

    pt_joystick_ctx->i4_op_block = i4_block ? 1 : 0;

    if (pt_joystick_ctx->i4_op_block == 0) {
        i4_open_flags |= O_NONBLOCK;
    }

    pt_joystick_ctx->i4_js_fd = open(cp_js_dev_name, i4_open_flags);
    if (pt_joystick_ctx->i4_js_fd < 0) {
        LOG_ERR("[%s] open device %s error\n", __func__, cp_js_dev_name);
        free(pt_joystick_ctx);
        return -1;
    }

    list_add_tail(&pt_joystick_ctx->list, &_t_js_ctx_head);

    return pt_joystick_ctx->i4_js_fd;
}

int joystick_close(int i4_fd)
{
    struct list_head* pt_entry;
    struct list_head* pt_next;
    JOYSTICK_CTX_T* pt_node;

    if (list_empty(&_t_js_ctx_head)) {
        LOG_ERR("[%s] device not opened\n", __func__);
        return -1;
    }

    list_for_each_safe(pt_entry, pt_next, &_t_js_ctx_head) {
        pt_node = list_entry(pt_entry, JOYSTICK_CTX_T, list);
        if (pt_node->i4_js_fd == i4_fd) {
            list_del_init(&pt_node->list);
            free(pt_node);
            return close(i4_fd);
        }
    }

    LOG_ERR("[%s] i4_fd=%d invalid\n", __func__, i4_fd);
    return -1;
}

int joystick_read_one_event(int i4_fd, struct js_event* tp_jse)
{
    int i4_rd_bytes;

    /*do not check i4_fd again*/

    i4_rd_bytes = read(i4_fd, tp_jse, sizeof(struct js_event));

    if (i4_rd_bytes == -1) {
        if (errno == EAGAIN) { /*when no block, it is not error*/
            return 0;
        }
        else {
            return -1;
        }
    }

    return i4_rd_bytes;
}

int joystick_read_ready(int i4_fd)
{
    int i4_block = 2;
    struct list_head* pt_entry;
    JOYSTICK_CTX_T* pt_node;

    if (list_empty(&_t_js_ctx_head)) {
        LOG_ERR("[%s] device not opened\n", __func__);
        return -1;
    }

    list_for_each(pt_entry, &_t_js_ctx_head) {
        pt_node = list_entry(pt_entry, JOYSTICK_CTX_T, list);
        if (pt_node->i4_js_fd == i4_fd) {
            i4_block = pt_node->i4_op_block;
            break;
        }
    }

    if (i4_block == 2) {
        LOG_ERR("[%s] i4_fd=%d invalid\n", __func__, i4_fd);
        return 0;
    }
    else if (i4_block == 1) {
        fd_set readfd;
        int i4_ret = 0;
        struct timeval timeout = {0, 0};
        FD_ZERO(&readfd);
        FD_SET(i4_fd, &readfd);

        i4_ret = select(i4_fd + 1, &readfd, NULL, NULL, &timeout);

        if (i4_ret > 0 && FD_ISSET(i4_fd, &readfd)) {
            return 1;
        }
        else {
            return 0;
        }

    }

    return 1; /*noblock read, aways ready*/
}


void debug_list(void)
{
        char s_char[128];
        int i = 0;


    if (! list_empty(&_t_js_ctx_head)) {
        struct list_head* pt_entry;
        JOYSTICK_CTX_T* pt_node;

        list_for_each(pt_entry, &_t_js_ctx_head) {
            pt_node = list_entry(pt_entry, JOYSTICK_CTX_T, list);
            LOG_DBG("fd:%d--block:%d\n", pt_node->i4_js_fd, pt_node->i4_op_block);
        }
    }
    else {
        LOG_DBG("-----------> EMPTY NOW\n");
    }
}

#if 1
typedef struct _axes_t {
    int x;
    int y;
} AXES_T;




int main()
{
    int fd, rc;
    char number_of_axes = 0;
    char number_of_btns = 0;

    char c_re[15][30];

    char js_name_str[128];
    unsigned int buttons_state = 0;
    AXES_T* tp_axes = NULL;
    int i, print_init_stat = 0;

        char but_sta = 0;
        char start_state = 0;


    struct js_event jse;

    fd = joystick_open("/dev/input/js0", 1);
    if (fd < 0)
    {
        LOG_ERR("open failed.\n");
        exit(1);
    }

    if( SerialInit() == -1 )
    {
        perror("SerialInit Error!\n");
        return NULL;
    }

    rc = ioctl(fd, JSIOCGAXES, &number_of_axes);
    if (rc != -1)
    {
        LOG_DBG("number_of_axes:%d\n", number_of_axes);
        if (number_of_axes > 0)
        tp_axes = (AXES_T*)calloc(sizeof(AXES_T), 1);
    }

    rc = ioctl(fd, JSIOCGBUTTONS, &number_of_btns);
    if (rc != -1)
    {
        LOG_DBG("number_of_btns:%d\n", number_of_btns);
    }

    if (ioctl(fd, JSIOCGNAME(sizeof(js_name_str)), js_name_str) < 0)
    {
        LOG_DBG(js_name_str, "Unknown", sizeof(js_name_str));
    }

    LOG_DBG("joystick Name: %s\n", js_name_str);


    while(1)
    {
        if (joystick_read_ready(fd))
        {
            rc = joystick_read_one_event(fd, &jse);
            if (rc > 0)
            {
                if ((jse.type & JS_EVENT_INIT) == JS_EVENT_INIT)
                {
                    if ((jse.type & ~JS_EVENT_INIT) == JS_EVENT_BUTTON)
                    {
                        if (jse.value)
                            buttons_state |= (1 << jse.number);
                        else
                            buttons_state &= ~(1 << jse.number);
                    }

                    else if ((jse.type & ~JS_EVENT_INIT) == JS_EVENT_AXIS)
                    {
                        if (tp_axes)
                        {
                            if ((jse.number & 1) == 0)
                                tp_axes[jse.number / 2].x = jse.value;
                            else
                                tp_axes[jse.number / 2].y = jse.value;
                        }
                    }
                }


                else
                {
                    if (print_init_stat == 0) //设备输出初始信息
                    {
                        for (i = 0; i < number_of_btns; i++)
                        {
                            sprintf(c_re[i], "but%d %d;", i, ((buttons_state & (1 << i)) == (1 << i)) ? 0 : 1);
                            LOG_DBG(c_re[i]);	//LOG_DBG("   %d", i);
                            LOG_DBG("joystick init state: button %d is %s.\n", i, ((buttons_state & (1 << i)) == (1 << i)) ? "DOWN" : "UP");
                        }

                        if (tp_axes)
                        for (i = 0; i < number_of_axes; i++) {
                        sprintf(c_re[i+11], "axes%d x=%d y=%d;", i, tp_axes[i].x, tp_axes[i].y);
                        LOG_DBG(c_re[i+11]);		//LOG_DBG("   %d", i+11);
                        LOG_DBG("joystick init state: axes %d is x=%d  y=%d.\n", i, tp_axes[i].x, tp_axes[i].y);
                        }
                                                //ready = 1;
                        print_init_stat = 1;
                    }


                    if (jse.type  == JS_EVENT_BUTTON) //按键状态改变时输出相关信息
                    {
                        if (jse.value)
                            buttons_state |= (1 << jse.number);
                        else
                            buttons_state &= ~(1 << jse.number);

                        //LOG_DBG("joystick state: button %d is %s.\n", jse.number, ((buttons_state & (1 << jse.number)) == (1 << jse.number)) ? "DOWN" : "UP");
                        bzero( c_re[jse.number], sizeof(c_re[jse.number]) );
                        but_sta = ((buttons_state & (1 << jse.number)) == (1 << jse.number)) ? 0 : 1;
                        sprintf(c_re[jse.number], "but%d %d;", jse.number, but_sta);
                        LOG_DBG("%s \n", c_re[jse.number]);
                        // jse.number为手柄按键序号  but_sta为按键当前状态
                    }

                    else if (jse.type == JS_EVENT_AXIS) //手杆状态改变时输出相关信息
                    {
                        if (tp_axes)
                        {
                            if ((jse.number & 1) == 0)
                                tp_axes[jse.number / 2].x = jse.value;
                            else
                                tp_axes[jse.number / 2].y = jse.value;

                            bzero( c_re[jse.number / 2 +11], sizeof(c_re[jse.number / 2 +11]) );
                            sprintf(c_re[jse.number / 2 +11], "axes%d x=%d y=%d;", jse.number / 2, tp_axes[jse.number / 2].x, tp_axes[jse.number / 2].y);
                            LOG_DBG("%s \n", c_re[jse.number / 2 +11]);
                            //tp_axes[jse.number / 2] jse.number/2为手杆序号  .x .y分别对应手杆当前x轴和y轴的值
                        }

                        else
                        {
                            LOG_DBG("joystick state: axes %d is %s=%d.\n", jse.number / 2, ((jse.number & 1) == 0) ? "x" : "y", jse.value);
                        }
                    }
                }
            }
        }
    }

    joystick_close(fd);

    if (tp_axes) {
        free(tp_axes);
    }

    return 0;
}
#endif


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Linux下使用游戏手柄 的相关文章

  • vue3 ts 中ref 调用子组件的方法

    const uploadModal 61 ref 数据中return return t value onSearch toRefs state columns getBasicColumns handleTableChange create
  • 在mac电脑上,用Safari浏览器调试ios手机移动端页面

    打开iphone手机的开发者模式 xff0c 流程是 xff1a 设置 gt Safari gt 高级 gt 开启 Web检查器 具体如下图所示 打开Mac上Safari的开发者模式 xff0c 流程是 Safari gt 偏好设置 gt
  • wordpress 网站迁移

    1 网站打包上传 2 数据备份上传 3 数据库里中的域名修改 UPDATE wp options SET option value 61 replace option value 39 old domain com 39 39 new do
  • 【go 格式化代码】

    gofmt l w s sample bucket metaquery go gofmt main go
  • go build

    1 MAC 下编译 Linux Windows linux CGO ENABLED 61 0 GOOS 61 linux GOARCH 61 amd64 go build o name main go windows CGO ENABLED
  • 给docker中的PHP安装 gd扩展

    在容器内使用docker php ext install gd安装gd xff0c 使用过程中一些程序报错Call to undefined function imagettftext 在phpinfo中发现它只支持png xff0c 所以
  • Ubuntu内核升级以及如何开启BBR加速(亲测可行,速度确实有所加快)

    BBR是个什么东西我就不赘述了 xff0c 可以理解为和锐速差不多的一个东西 xff0c 但是呢 xff0c 锐速过高的价格和不再低端售卖 导致了我们并无法实现一个免费好用的单边加速功能 xff1b 所以 xff0c 在这个前提下 xff0
  • android wifi ap 自动开启

    花了几天时间 xff0c 了解了下android wifi 从上到下的流程 实现了自动开启wifi热点 找到了些资料 在这分享给大家了 xff01 http blog csdn net androidchuxueze article det
  • mac 笔记本安装vue,始终找不到命令

    亲测有效 这种问题我已经解决了 xff0c 主要是你的npm全局路径不对导致的 npm安装一些常见工具比如 gulp npm install g gulp 提示安装成功之后 xff0c 使用发现不存在comman gulp 这个时候我们要检
  • python selenium 爬取领英的数据

    coding utf 8 import os import pickle import time from selenium import webdriver from selenium webdriver support wait imp
  • go语言基础(二):切片

    切片的定义 切片的基本定义初始化如下 xff1a span class token comment 定义空切片 span a span class token operator 61 span span class token punctu
  • Python教程一:Python环境安装(Anaconda3版本)

    前言 Anaconda包括Conda Python及大部分集成的工具包 初学者建议直接安装Anaconda3会省去很多工具包的安装过程 优势 xff1a 若新建一个项目或者使用不同于Anoconda装的基本Python版本 xff0c An
  • 【Qt】Creator调试卡死挂起-starting debugger cdbengine for abi 【2023.03.23】

    解决方案 xff1a 删除这个文件 xff1a C Users 你的用户名 AppData Roaming QtProject qtcreator debuggers xml 重启QtCreator
  • ubuntu安装显卡驱动后无法进入系统

    如果你的电脑有一下问题 1 ubuntu系统登录界面输入密码重复登录 2 ubuntu系统登录界面输入密码之后显示桌面背景 xff0c 左下角有版本号 以上两种问题一般都由于显卡驱动安装存在问题 xff0c 通过文本命令行进入重新安装 xf
  • Linux实战(7):centos7安装xrdp

    系统环境 xff1a 最小化安装 xff0c 无安装桌面化 操作 yum更新 yum y update 安装依赖 tigervnc server xrdp GNOME Desktop yum y span class token funct
  • 真正免费的天气API,无需注册申请key

    文章目录 1 中华万年历的天气API2 讯飞语音识别内置的墨迹天气API3 乐享天气APP 无聊整理的真正免费的天气API xff0c 无需注册申请key等 xff0c 当然部分数据解析需要自己理解下 xff0c 也不是所有天气数据都有 x
  • VS2012无法启动调试,只显示会附加到进程

    VS2012无法启动调试 xff0c 只显示会附加到进程 不知道有人遇到这个问题没 但希望这点小经验能给遇到问题的童鞋带来帮助 今天在使用VS2012的时候 xff0c 打开突然发现 xff0c 只显示附加到进程 xff0c 无法进行调试
  • “error C3872 此字符不允许在标识符中使用” 的解决

    1 最近笔者写程序 xff0c 突然遇到莫名其妙的问题 xff0c vs2012报error C3872 此字符不允许在标识符中使用 的错误 xff0c 然后就一堆胡乱报错 xff0c 刚开始的时候一直以为是代码问题 xff0c 其实不是这
  • ext4格式的 system.img 怎么修改

    Linux Ubuntu 10 04 file system img就可以看到这个文件是个什么格式的了 system img Linux rev 1 0 ext4 filesystem data gingerbread的system img
  • GitHub Desktop的简单使用

    1 今天来说说GitHub 客户端的使用 xff0c 什么 你没听说过GitHub xff1f 那算了 xff0c 那你真是太low xff0c 自己百度 记得第一次听说和使用关于GitHub这些还是好几年前闲得慌学着在GitHub上使用o

随机推荐

  • EasyX的安装与使用

    考研结束了好几天 xff0c 开始写一些东西吧 xff0c 把以前做的东西做些梳理 1 EasyX是一个轻量级的简单的C 43 43 图形库 xff0c 可以用来做些简单的演示2d类游戏 xff0c 没有cocos2d x那样重量级 xff
  • 2-1000之间的完数

    题目描述 xff1a 编写程序显示2 1000之间的说有完数 xff0c 所谓完数是指 xff0c 该数的各因子之和正好等于该数本身 代码 xff1a span class hljs preprocessor include lt stdi
  • Android Studio R报红的总结

    做个笔记 xff0c 懒得折腾格式 1 一般由于 xff0c 电脑太慢 xff0c 等一会就差不多了 xff0c 或者重启studio xff0c 甚至电脑 xff0c 记得当年as1 0就经常要这样 2 或者刷新gradle 3 看到有人
  • 基于Android平台的个人时间管理系统的设计与实现

    0 前言 另外一个毕设作品 xff0c 功能不算完善 xff0c 主体框架使用了 高效Android工程师6周养成计划 里面的项目内容 xff0c 其中最核心功能就是仿照 我要当学霸 这个软件的形式实现的监督不让用户玩手机的功能 xff0c
  • PDF内复制文字多余换行问题【完美解决】

    问题描述 从PDF中复制文字后粘贴 xff0c 结果每行出现换行 影响最大的就是笔者google翻译论文的时候 xff0c 效果很差 多出的换行符 翻译效果 xff0c 目不忍视 解决办法 使用工具 sublime 使用快捷键 shift
  • 15.【cocos2d-x 源码分析】:localStorage的详细分析

    对应源码位置 xff1a cocos2d x 3 3 cocos storage local storage localStorage localStorage 的接口 cocos2d x提供了简单的本地数据存储的功能 xff0c 其主要是
  • 16【cocos2d-x 源码分析】:HttpClient 的详细分析

    对应源码位置 xff1a cocos2d x 3 3 cocos network Http HttpRequest的实现 span class token keyword typedef span std span class token
  • 17【cocos2d-x 源码分析】:多分辨率支持的详细分析

    对应源码位置 xff1a cocos2d x 3 3 cocos platform GLView 设计分辨率与屏幕分辨率 cocos2d x中 xff0c 进行游戏设计时使用逻辑上的设计分辨率 xff0c 当具体游戏运行在物理机上时对应具体
  • ubuntu与Windows进行远程连接

    安装xrdp sudo apt get install xrdp 安装vnc4server sudo apt get install vnc4server 安装xubuntu desktop sudo apt get install xub
  • Python 爬取ts流视频

    准备工具 1 安装python xff0c 本机环境linux 43 python3 6 2 直接开撸 xff0c 基本的包需要pip install 3 话不多说直接干 https www com video 2 1 html某网站 xf
  • JS报错-TypeError: xxx is not a function

    在今天的工作中 xff0c 有个勾选框的onchage事件绑定的函数明明有实现 但是触发时 xff0c 一直报错TypeError xxx is not a function 一直以为是错误Uncaught ReferenceError a
  • 深入理解Python中的if语句

    公众号 xff1a 尤而小屋 作者 xff1a Peter 编辑 xff1a Peter 大家好 xff0c 我是Peter 在生活中总是会听到这样的话 xff1a 如果我上课认真一点 xff0c 英语肯定可以及格如果我努力锻炼 xff0c
  • NVIDIA 显卡驱动安装

    补充 xff1a 这篇博文目前是整理的结果 xff0c 之前安装了 xff13 xff18 xff14 xff0c 但是之前电脑卡死次数太多 xff0c 强制重启后 xff0c 突然驱动就没有了 xff0c 扩展屏幕也用不了 xff0c 因
  • beego打包linux运行包命令

    span class hljs attribute bee pack be GOOS span 61 span class hljs string linux span
  • Web安全原理剖析(十六)——DOM型XSS攻击

    目录 4 7 DOM型XSS攻击4 8 DOM型XSS代码分析 4 7 DOM型XSS攻击 DOM型XSS攻击页面实现的功能是在 输入 框中输入信息 xff0c 单击 替换 按钮时 xff0c 页面会将 这里会显示输入的内容 替换为输入的信
  • QScrollArea 无法通过样式改变背景色,无法去除边框

    QScrollArea 无法通过样式改变背景色 xff0c 无法去除边框 QScrollArea 是无法通过样式表来改变背景色的 xff0c 只能设置加入到QScrollArea里面的QWidget的样式 xff0c 这样才能改变背景色 当
  • 将驱动编译成.ko文件添加到嵌入式Linux系统下

    为减少内核所占的空间 xff0c 很多时候我们在编译内核时都会选择裁去一些暂时不用的驱动 xff0c 当我们在使用时找不到对应的驱动 xff0c 除了重新编译内核外 xff0c 一个比较方便的做法是将对应的驱动编译成 ko文件 xff08
  • 嵌入式Linux上没有wlan0

    有时候我们的嵌入式板子上有无线网卡 xff0c 可是无法连接到wifi上 xff0c 使用 sudo ifconfig 也看不到 wlan0 的相关信息 这时我们可以使用 sudo ifconfig a 看一下具体信息 xff0c 我们可以
  • Linux远程界面中Tab键不能补全

    我们在使用嵌入式Linux板子的时候 xff0c 时常需要使用到远程界面 xff0c 可以通过本地电脑对板子进行操作 xff0c 显得相对便捷 在远程界面的使用中 xff0c 不可避免地要在终端进行命令输入 xff0c 这时可能出现Tab键
  • Linux下使用游戏手柄

    大多数情况下 xff0c Linux系统都带有手柄驱动模块joydev xff0c 当我们插上设备的时候可以通过以下指令查看是否检测到该设备 ls dev 或者 ls dev input 如果有出现 js0 的设备 xff0c 则证明设备能