ページ 11

画像のドラッグについて(DX)

Posted: 2013年9月29日(日) 17:31
by ららいふ2

コード:


#include "DxLib.h"

#define  WAIT_TIME 1
#define FIVE_BLOCK 180
#define FOUR_BLOCK 160
#define THREE_BLOCK 140
#define TWO_BLOCK 120
#define ONE_BLOCK 100
#define ALL_BLOCK_Y 95
#define KASANARI 25
#define AIDA 220
#define AAIDA 420

struct position
{       
	  int x;
	  int y;
	
};


struct position one;
struct position two;
struct position three;
struct position four;
struct position five;

        



void Draw()
{
    
	    static int near_Backhandle = LoadGraph("画像/背景.png");
	
        static int one_block = LoadGraph("画像/1.png");
		static int two_block = LoadGraph("画像/2.png");
		static int three_block = LoadGraph("画像/3.png");
		static int four_block = LoadGraph("画像/4.png");
        static int five_block = LoadGraph("画像/5.png");
		
	
		
	
		


        DrawExtendGraph( five.x ,five.y, five.x+THREE_BLOCK, five.y+ALL_BLOCK_Y,  five_block, TRUE);
	    DrawExtendGraph( four.x , four.y,four.x+THREE_BLOCK, four.y+ALL_BLOCK_Y,  four_block, TRUE);
	    DrawExtendGraph( three.x , three.y, three.x+THREE_BLOCK,three.y+ALL_BLOCK_Y, three_block, TRUE);
	    DrawExtendGraph( two.x , two.y, two.x+THREE_BLOCK,two.y+ALL_BLOCK_Y, two_block, TRUE);
		DrawExtendGraph( one.x , one.y, one.x+THREE_BLOCK,one.y+ALL_BLOCK_Y, one_block, TRUE);


		ScreenFlip();
}

void move(){
int Mouse;
int Mouse_x,Mouse_y;
        

Mouse = GetMouseInput();  
SetMouseDispFlag(TRUE);
 GetMousePoint(&Mouse_x,&Mouse_y);
 
 
 if ( Mouse&MOUSE_INPUT_LEFT ){

	 if(one.x + THREE_BLOCK > Mouse_x && Mouse_x >one.x && one.y +50 > Mouse_y && Mouse_y > one.y  ){
                             one.x = Mouse_x;
							 one.y = Mouse_y;
	 }

	 if(two.x + THREE_BLOCK > Mouse_x && Mouse_x >two.x && two.y+50 > Mouse_y && Mouse_y > two.y  ){
                             two.x = Mouse_x;
							 two.y = Mouse_y;
	 }
		 if(three.x + THREE_BLOCK > Mouse_x && Mouse_x >three.x && three.y +50> Mouse_y && Mouse_y> three.y  ){
                             three.x = Mouse_x;
							 three.y = Mouse_y;
	 }

		 if(four.x + THREE_BLOCK > Mouse_x  && Mouse_x>four.x && four.y +50 > Mouse_y && Mouse_y> four.y  ){
                             four.x = Mouse_x;
							 four.y = Mouse_y;
	 }

		 if(five.x + THREE_BLOCK > Mouse_x  && Mouse_x > five.x && five.y +50 > Mouse_y && Mouse_y> five.y  ){
                             five.x = Mouse_x;
							 five.y = Mouse_y;
	 }
 
 }

}


void dainyuu(){
        one.x = 40;
		two.x = 40;
		three.x = 40;
		four.x = 40;
		five.x = 40;
		one.y = 150;
		two.y = 200;
		three.y = 250;
		four.y  = 300;
		five.y = 350;
}


int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){
        ChangeWindowMode(TRUE);

		   SetBackgroundColor(255,255,255);
		DxLib_Init(); 
		SetDrawScreen( DX_SCREEN_BACK ); //ウィンドウモード変更と初期化と裏画面設定


		
		dainyuu();

         while( 1 ){

			 Draw();
			 move();
			 ClearDrawScreen();
                ProcessMessage();
                if( CheckHitKey(KEY_INPUT_ESCAPE) == 1 ){
                        break;
                }
				 
        }

      
        

        DxLib_End(); // DXライブラリ終了処理
        return 0;
}

ドラッグできません
必要な処理等があったらおしえてください

Re: 画像のドラッグについて(DX)

Posted: 2013年9月29日(日) 17:34
by softya(ソフト屋)
申しわけありません。
フォーラムルールを守っていただけますでしょうか。
http://dixq.net/board/board.html

まず、他のを解決されてから次の質問に移っていただくようにお願いします。