プログラム中のBIT青とBIT赤という二つの画像が、
右左に動かすと画像がずれて表示され、
移動させていないとずれずに表示されるということになってしまいました。
#include "DxLib.h"
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
//////////////////////////////////////////////////////////////
// //
// 画面サイズ変更(800×600の16Bitのウインドウモード) //
// //
//////////////////////////////////////////////////////////////
SetGraphMode( 800 , 600 , 16 ) ;
// ウインドウモードに変更
ChangeWindowMode( TRUE ) ;
if( DxLib_Init() == -1 ) // DXライブラリ初期化処理
{
return -1; // エラーが起きたら直ちに終了
}
SetDrawScreen( DX_SCREEN_BACK ) ; // 描画先画面を裏にする
SetTransColor(0,255,0); //透過色の指定 右からR,G,B
int GHandle ;
int Bar;
int BitA[3];
int BitB[3];
GHandle = LoadGraph( "kyara\\test2.jpg" ) ;
Bar = LoadGraph( "kyara\\musicbar.bmp" ) ;
LoadDivGraph( "kyara\\musicbitA.bmp" , 3 , 3 , 1 , 15 , 40 , BitA ) ;// BMP画像のメモリへの分割読み込み
LoadDivGraph( "kyara\\musicbitB.bmp" , 3 , 3 , 1 , 45 , 60 , BitB ) ;// BMP画像のメモリへの分割読み込み
int j , i ;
int End = 0;
i = 0;
j = 650;
int Key;
int a,b;
a = 1;
b = -1;
int BarKari[3][20];
int BarKariRand;
while( End != 1 ){
ClearDrawScreen() ; // 画面を初期化
Key = GetJoypadInputState(DX_INPUT_KEY_PAD1);
if(Key & PAD_INPUT_RIGHT) i = i + a , j = j + b;
if(Key & PAD_INPUT_LEFT) i = i - a , j = j - b;
if(Key & PAD_INPUT_A){
if( a == 10){
}else{
a ++ , b --;
}
}
if(Key & PAD_INPUT_B){
if( a == 1){
}else{
a -- , b ++;
}
}
if(Key & PAD_INPUT_C) End = 1;
DrawGraph( 0 , 0 , GHandle , TRUE ) ;
DrawGraph( 0 , 0 , Bar , TRUE ) ;
DrawGraph( i , 0 , BitA[ 0 ] , TRUE ) ; //BIT赤
DrawGraph( i , 40 , BitA[ 1 ] , TRUE ) ; //BIT青
DrawGraph( i , 80 , BitA[ 2 ] , TRUE ) ; //BIT黄
DrawGraph( i , 120 , BitB[ 0 ] , TRUE ) ; //BIT←
DrawGraph( i+45 , 120 , BitB[ 1 ] , TRUE ) ; //BIT→
DrawGraph( i+90 , 120 , BitB[ 2 ] , TRUE ) ; //BIT↑
ScreenFlip() ; // 裏画面の内容を表画面に映す
if( ProcessMessage() == -1 ) //これがないとキーが動きません
{
break ; // エラーが起きたらループから抜ける
}
}
DxLib_End(); // DXライブラリ使用の終了処理
return 0 ; // ソフトの終了
}
いろいろ試しましたが出来ません。
お手数をおかけしますが、よろしくお願いします。