先月からDXライブラリでプログラミングを始めた者です。
描写している物の消去について分からない事があるので質問しました
------------------------------------------------------------------------------------------------------------------------------
#include "DxLib.h"
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
ChangeWindowMode( TRUE ) ; // ウインドウモードに変更
if( DxLib_Init() == -1 ) return -1; // DXライブラリ初期化処理 エラーが起きたら終了
char Key[256];
int White;
White = GetColor( 255 , 255 , 255 ) ; // 白色の値を取得
LoadGraphScreen( 0 , 0 , "back.png" , TRUE ) ;//背景表示
while(!ProcessMessage() && !ClearDrawScreen() && !GetHitKeyStateAll( Key ) && !Key[KEY_INPUT_ESCAPE]){
if( Key[ KEY_INPUT_RIGHT ] == 1 ) //右ボタンが押されたら
DrawString( 0, 0, "hello! DX Library!" , White); //文字列表示
}
DxLib_End() ; // DXライブラリ使用の終了処理
return 0 ; // ソフトの終了
}
------------------------------------------------------------------------------------------------------------------------------
この様に背景画像を表示をした後に文字列を描写したら、文字列だけを消すことはできないのでしょうか?
それとも、上からもう一度背景画像を表示するようにしないといけないのでしょうか?
もし文字だけを消せるのであれば、画像を重ねる時より処理は速くなるのでしょうか
文字列描写の消去
Re:文字列描写の消去
#include "DxLib.h" int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ) { ChangeWindowMode( TRUE ) ; // ウインドウモードに変更 if( DxLib_Init() == -1 ) return -1; // DXライブラリ初期化処理 エラーが起きたら終了 SetDrawScreen( DX_SCREEN_BACK ); char Key[256]; int White; White = GetColor( 255 , 255 , 255 ) ; // 白色の値を取得 int graph = LoadGraph("back.png"); // 画像読込 while(!ProcessMessage() && !ClearDrawScreen() && !GetHitKeyStateAll( Key ) && !Key[KEY_INPUT_ESCAPE]) { DrawGraph(0, 0, graph, TRUE); // 背景表示 if( Key[ KEY_INPUT_RIGHT ] == 1 ) //右ボタンが押されたら DrawString( 0, 0, "hello! DX Library!" , White); //文字列表示 ScreenFlip(); } DxLib_End() ; // DXライブラリ使用の終了処理 return 0 ; // ソフトの終了 }