提示コードの最下部の`void
Screen::Renderer()const`関数部ですがなぜ`werase(window);`関数で画面を削除して`wrefresh(window);`関数で再描画しているのにもかかわらず描画されないのでしょうか？
色んなサイトを調べてリファレンスを確認しましたがどうしてもわかりません。  
※window変数が`PAD`です。

参考サイト：
[http://www5d.biglobe.ne.jp/~kobamasa/comp/Linux/tips/curses.html](http://www5d.biglobe.ne.jp/%7Ekobamasa/comp/Linux/tips/curses.html)

Github: <https://github.com/Shigurechan/AsciiArtEditor>

##### Screen.cpp

```

    #include "../header/Screen.hpp"
    
    
    #include "../header/Character.hpp"
    #include "../header/Color.hpp"
    #include "../header/Vector.hpp"
    
    
    
    //　######################## コンストラクタ ######################## 
    Screen::Screen(int x,int y,int xMin,int yMin,int xMax,int yMax)
    {
    
          //ウインドウ初期化
        //getmaxyx(stdscr,windowSize.y,windowSize.x);
        window = newpad(yMax - yMin,xMax - xMin);
        //prefresh(window,posY,posX,posY,posX,posY + sizeY,posX + sizeX);
        prefresh(window,y,x,yMin,xMin,yMax,xMax);
    
          position.x = x;
          position.y = y;
    
          size.x = xMax - xMin;
          size.y = yMax - yMin;
          
          maxSize = size.x * size.y;
    
          stage = std::make_unique<std::vector<Character>>(size.x * size.y);
          
          for(std::vector<Character>::iterator itr = stage->begin(); itr != stage->end(); itr++)
          {
                itr->chr = ' ';
                itr->color = GetColorNum(2,2);
                itr->type = 0;
          }
    }
    
    
    //　######################## 移動 ########################
    void Screen::Move(int x,int y)
    {
          position.x = x;
          position.y = y;
    
        prefresh(window,position.y,position.x,position.y,position.x,position.y + size.y,position.x + size.x);       
    }
    
    
    //　######################## 画面サイズ更新 ########################
    void Screen::UpdateScreen()
    {
    
    }
    
    
    
    //　######################## Update ########################
    void Screen::Update()
    {
          
    }
    
    //　######################## 文字設定 ######################## 
    void Screen::Input(int x,int y,Character c)
    {
          stage->at((y * size.x) + x) = c;
    }
    
    //　######################## 文字削除 ######################## 
    void Screen::Delete(int x,int y)
    {
          stage->at((y * size.x) + x).chr = ' ';
          stage->at((y * size.x) + x).color = 0;
          stage->at((y * size.x) + x).type = 0;
    }
    
    //　######################## Renderer ######################## 
    void Screen::Renderer()const
    {
          //clear();
          werase(window);
          //erase();
    
          for(int y = 0; y < size.y; y++)
          {
                for(int x = 0; x < size.x; x++)
                {
                      wattron(window,COLOR_PAIR(stage->at((y * size.x) + x).color));
    
                      mvwaddch(window,position.y + y,position.x + x,stage->at((y * size.x) + x).chr);
                      
                      wattroff(window,COLOR_PAIR(stage->at((y * size.x) + x).color));
    
                }
          }
    
          wrefresh(window); //描画
          //refresh();
    
    }
    
    //　######################## デストラクタ ######################## 
    Screen::~Screen()
    {
    
    
    }
    
    
```

##### Edit.cpp

```

    #include <stdlib.h>
    #include <iostream>
    
    #include "../lib/ncurses/include/curses.h"
    
    #include "../header/Log.hpp"
    #include "../header/Vector.hpp"
    #include "../header/Edit.hpp"
    #include "../header/Screen.hpp"
    #include "../header/Entry.hpp"
    #include "../header/Character.hpp"
    #include "../header/Color.hpp"
    #include "../header/SaveMenu.hpp"
    
    
    #define HOLD_FRAME ((int) 30)
    
    #define ESC_KEY ((int)27)
    
    
    //　######################## コンストラクタ ######################## 
    Edit::Edit(Entry* e) : Scene(e)
    {
        holdPressed = 0;
    
        position.x = 0;
        position.y = 0;
        
        drawCharacter.chr = '@';
        drawCharacter.color = 0;
        drawCharacter.type = 0;
    
    
        canvasPosition.x = 20;
        canvasPosition.y = 10;
    
    
    
        //Print("%d\n",sizeof(drawCharacter));
    
        canvas = std::make_unique<Screen>(canvasPosition.x,canvasPosition.y,canvasPosition.x,canvasPosition.y,canvasPosition.x + 10,canvasPosition.y + 10); //前景
    
    
        saveMenu = std::make_unique<SaveMenu>(Scene::Menu_Sequence::Save,100,100,10,0);
    }
    
    //　######################## Keyboard Input ######################## 
    void Edit::KeyInput()
    {
        int key = getch();
        switch(key)
        {
            case KEY_LEFT:
            {
                position.x--;
                canvasPosition.x--;
    
            }
            break;
    
            case KEY_RIGHT:
            {
                position.x++;
                canvasPosition.x++;
            }
            break;
    
            case KEY_DOWN:
            {
                canvasPosition.y++;
    
                position.y++;
            }
            break;
    
            case KEY_UP:
            {
                canvasPosition.y--;
    
                position.y--;
            }
            break;
        }
    
    
        //書き込み
        if(key == ' ')
        {
            canvas->Input(position.x,position.y,drawCharacter); 
        }
        
    
    
    
    
        //ESCで終了
        if(key == ESC_KEY)
        {
            entry->ChangeScene(Scene::Sequence::Exit);
        }
    }
    
    //　######################## Update ######################## 
    void Edit::Update()
    {
        canvas->Move(canvasPosition.x,canvasPosition.y);
        
    
    
        MouseInput();   //マウス入力
        KeyInput();     //キー入力
    
        move(position.y,position.x);    //カーソル移動
    }
    
    //　######################## Renderer ######################## 
    void Edit::Renderer()const
    {
    
        canvas->Renderer(); //キャンバス
    
        
    
        //saveMenu->Renderer();
    }
    
    
    //　######################## Mouse Input ######################## 
    void Edit::MouseInput()
    {
        
        //マウス移動イベント
        if(getmouse(&mouseEvent) == OK)
        {
            //マウス座標
            if(mouseEvent.bstate & REPORT_MOUSE_POSITION)
            {
                position.x = mouseEvent.x;
                position.y = mouseEvent.y;
            }           
        }
        
    
        //長押し判定
        if(prevClickEvent.bstate & BUTTON1_PRESSED)
        {
            holdPressed++;
            if(holdPressed > HOLD_FRAME)
            {
                prevClickEvent.bstate = BUTTON1_PRESSED;
                canvas->Input(position.x,position.y,drawCharacter);
                holdPressed = HOLD_FRAME + 1;
            }
        }
        else
        {
            prevClickEvent.bstate = 0;
            holdPressed = 0;
        }
        
    
        //クリックイベント
        if(getmouse(&clickEvent) == OK)
        {
            //Left Click
            if(clickEvent.bstate & BUTTON1_PRESSED )
            {
                prevClickEvent.bstate = BUTTON1_PRESSED;
                canvas->Input(position.x,position.y,drawCharacter);
            }       
            else if(clickEvent.bstate & BUTTON1_RELEASED)
            {
                prevClickEvent.bstate = 0;
            }       
            else if(clickEvent.bstate & BUTTON1_CLICKED)
            {
            }       
            else if(clickEvent.bstate & BUTTON1_DOUBLE_CLICKED)
            {
            }       
            else if(clickEvent.bstate & BUTTON1_TRIPLE_CLICKED)
            {
            }       
            
    
            //Right Click
            if(clickEvent.bstate & BUTTON1_PRESSED)
            {
            }       
            else if(clickEvent.bstate & BUTTON1_RELEASED)
            {
            }               
            else if(clickEvent.bstate & BUTTON1_DOUBLE_CLICKED)
            {
            }           
            else if(clickEvent.bstate & BUTTON1_TRIPLE_CLICKED)
            {
            }       
            else if(clickEvent.bstate & BUTTON1_CLICKED)
            {
            }       
        }
        
    
    }
    
    //　######################## Loop ######################## 
    void Edit::Loop()
    {
        Update();
        Renderer();
    }
    
    
    
    //　######################## デストラクタ ######################## 
    Edit::~Edit()
    {
    
    }
    
    
    
```
CC BY-SA 4.0
2021-09-24T13:09:19.700
82665
2021-09-25T05:36:24.640
2021-09-24T13:40:54.700
4236
question
c++
ncurses ライブラリ　PADを描画がする方法が知りたい