标签: ncurses

配置已安装的PHP以使用已安装的ncurses(MAMP)

我已经安装了MAMP,它附带的PHP没有用ncurses编译.我试图使用port来安装ncurses,它似乎已经存在于我的系统中,所以现在我想知道是否有办法让PHP使用它而无需重新编译PHP --with-ncurses.

换句话说:PHP可以配置为使用ncurses而无需重新编译吗?

php ncurses configure

1
推荐指数
1
解决办法
2720
查看次数

只是?找到没有敌人的游戏画面部分的算法

我必须为我的学校项目进行游戏.

选择没有敌人的游戏画面部分我有一点问题.

请看这个屏幕,我试着解释一下. 第一个屏幕 ,第二个屏幕.

好吧,所以我有球员,我可以让他在比赛场地 - 从一个边界到第二个边界.而且还有一个"敌人".问题是,我必须选择没有敌人的区域(除了玩家线).

有谁知道我能做到这一点,有一些合理的速度和内存(我不必声明char数组[width_screen] [height_screen];)

谢谢

c algorithm ncurses

1
推荐指数
1
解决办法
140
查看次数

控制台输入中的基于箭头的命令历史记录(C++)

我正在尝试构建一个需要用户输入的控制台应用程序.我能够使用printf将光标保持在同一个地方,我也可以使用curses,但是我无法启动向上箭头命令历史记录.有什么指针吗?

c++ ncurses

1
推荐指数
1
解决办法
1724
查看次数

为什么广泛的性格困扰?

在尝试使用ncurses进行一些工作时,我已经到了需要使用宽字符,盒子绘图以及其他东西的地步,而且我处于每个tile控件很有用的情况.

但是,在尝试使用以下代码时,我遇到了麻烦:

#define _XOPEN_SOURCE_EXTENDED

#include <locale.h>
#include <curses.h>
#include <stdlib.h>
#include <time.h>

#define ESC 27

int main() {
  setlocale(LC_CTYPE, "");

  initscr();
  keypad(initscr(),1);
  curs_set(9);
  nonl();

  cchar_t special;
  setcchar(&special, L"æ", 0, COLOR_PAIR(0), NULL);

  cchar_t speshul;
  setcchar(&speshul, L"?", 0, COLOR_PAIR(0), NULL);

  int c=0;
  do {
    clear();

    mvadd_wch(3,6, &special);
    mvadd_wch(4,6,&speshul);

    refresh();

  } while ((ESC!=(c=getch())));

  endwin();
}
Run Code Online (Sandbox Code Playgroud)

编辑:

更新了要使用的代码setcchar; 输出令人沮丧:

?
Run Code Online (Sandbox Code Playgroud)

一个问号special应该在哪里,什么也不speshul应该在哪里.

两个角色都没有按预期显示.

问题在哪里,我该如何解决?

编辑:响应Petesh的一些额外信息:

预期的结果是打印字符"æ",在其下面,朝.我在Mac OS X上使用Terminal.app; 我正在编译它Xcode.

c ncurses

1
推荐指数
1
解决办法
1709
查看次数

Ncurses:F1-F5键

我在curses.h中有一个带有功能键的Probclem.我在不同的网站/教程上看到了这个小小的程序

#include <ncurses.h>

int main()
{       int ch;

    initscr();                      /* Start curses mode            */
    raw();                          /* Line buffering disabled      */
    keypad(stdscr, TRUE);           /* We get F1, F2 etc..          */
    noecho();                       /* Don't echo() while we do getch */

    printw("Type any character to see it in bold\n");
    ch = getch();
    while (ch != KEY_F(1))
    {
            if(ch == KEY_F(1))      
                    printw("F1 Key pressed: Ending program.\n");

            else
            {       printw("The pressed key is ");
                    attron(A_BOLD);
                    printw("%c\n", ch);
                    attroff(A_BOLD);
            }

            refresh();     

            ch = getch();

    }
    printw("end\n"); …
Run Code Online (Sandbox Code Playgroud)

curses ncurses

1
推荐指数
1
解决办法
4794
查看次数

curses.h中空格键的关键代码是什么

我只是有一个简单的问题,我找不到curses.h中空格键的关键代码.恩.我知道down的代码是KEY_DOWN.有人可以帮忙吗?

c curses ncurses

1
推荐指数
2
解决办法
2万
查看次数

如何用ASCII码移动终端光标?

#include <stdio.h>
int main()
{
    printf("asd");
    char code[4] = { 0x08 ,  0x1b , 0x5b ,0x4b } ; 
    int i = 0 ; 
    while ( i  < 4  )
    {   
        putc(code[i], stdout);
        i++;
    }   
    printf("\n");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

输出:

[root@localhost ~]# ./a.out

作为

[root@localhost ~]#

似乎代码 "0x08" 将终端光标向左移动到字母 "d" 位置,而 "0x1b , 0x5b ,0x4b" 清除字母 "d" 。我想知道一些代码的含义,比如 { 0x08 , 0x1b , 0x5b ,0x4b } 。有相关资料吗?

谢谢。

c bash terminal ncurses

1
推荐指数
1
解决办法
6048
查看次数

Valgrind使用适当的free()和end()后,显示ncurses命令的内存泄漏

我有一个正在编写的程序可以更好地理解ncurses,当我将其推送通过时valgrind,它会输出与ncurses命令相关的许多泄漏。但是,我仅使用stdscrendwin()在末尾调用main()。我通过使用menu.h设置了用户选项,并在最后使用了free_item和free_menu:

menuChoice(WINDOW* scr, std::vector<std::string> *choices,
    std::string desc)
{
    //create the menu and the item pointer vector
    MENU* my_menu;
    std::vector<ITEM*> my_items;
    ITEM* cur = NULL;
    for (int x = 0; x < choices->size(); x++)
    {
        //populate the items vector with the string data in choices
        my_items.push_back(new_item(choices->at(x).c_str(), NULL));
    }
    //pushback a null item
    my_items.push_back((ITEM*)NULL);
    //create the menu and attach the items
    my_menu = new_menu((ITEM**)my_items.data());
    //print the desc and post the menu
    mvwprintw(scr, LINES - …
Run Code Online (Sandbox Code Playgroud)

c c++ curses memory-leaks ncurses

1
推荐指数
1
解决办法
2413
查看次数

if语句使用Linux Ncurses进行分段错误

我的代码工作正常,直到第27行(if(answer == answer2)),当它到达程序崩溃并在我的终端写入"分段错误".

它应该工作,因为if语句比较两个字符串,如果这些字符串相同,它会执行一个操作,如果它们不执行另一个操作,但不知道它为什么不起作用.

我是初学程序员.

这是代码:

#include <iostream>
#include <string>
#include <cstdlib>
#include <ncurses.h>
using namespace std;

int main () {
        char persentage = '%';
        initscr();
        curs_set(0);
        string answer;
        string answer2;
        int tipi,tipi2;

        move(8,0);
        printw("Enter the phenotype of parent 1: ");
        curs_set(1);
        scanw("%s",&answer);
        curs_set(0);
        move(9,0);
        printw("Is the phenotype fully dominant(AA) or partly(Aa)? (type '1' for AA, '2' for Aa): ");
        curs_set(1);
        scanw("%d",&tipi); 
        curs_set(0);
        move(11,0);
        printw("Enter the phenotype of parent 2: ");
        curs_set(1);
        scanw("%s",&answer2);
        curs_set(0);
        if(answer == answer2) { …
Run Code Online (Sandbox Code Playgroud)

c++ linux ncurses

1
推荐指数
1
解决办法
70
查看次数

ncurses在cchar_t上找不到任何文档

我试图从我的ncurses终端读取一个字符,其中mvin_wch()返回一个cchar_t,我知道这是一个包含颜色信息和wchar_t等内容的结构.我似乎无法找到有关此cchar_t的任何信息.我只是不知道它的成员名字是什么.我不明白为什么ncursesw库的这么重要的部分没有在任何地方记录.

c c++ unicode ncurses

1
推荐指数
1
解决办法
278
查看次数

标签 统计

ncurses ×10

c ×6

c++ ×4

curses ×3

algorithm ×1

bash ×1

configure ×1

linux ×1

memory-leaks ×1

php ×1

terminal ×1

unicode ×1