質問編集履歴
3
ソースコードの追加
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -13,8 +13,47 @@ 
     | 
|
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            申し訳ありませんがアドバイスをいただければ幸いです。よろしくお願いします。
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
            ### 開発環境
         
     | 
| 
       16 
17 
     | 
    
         
             
            Windows10, Visual Studio 2017 Community, C++
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
            ### 試したこと
         
     | 
| 
       19 
20 
     | 
    
         
             
            ・サイトではコピペするdllファイルが, SDL2.dll, SDL2_image.dll, libpng16-16.dllのみでしたが、全てのdllファイルをコピペしました。
         
     | 
| 
       20 
     | 
    
         
            -
            ・本からダウンロードしたコードではSDL2とSDL2_imageのヘッダファイル名が違っていたため、自分がダウンロードしたもののヘッダファイル名に変更しました。
         
     | 
| 
      
 21 
     | 
    
         
            +
            ・本からダウンロードしたコードではSDL2とSDL2_imageのヘッダファイル名が違っていたため、自分がダウンロードしたもののヘッダファイル名に変更しました。
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ### ソースコード(関連部分)
         
     | 
| 
      
 24 
     | 
    
         
            +
            Ship::Ship(Game* game)
         
     | 
| 
      
 25 
     | 
    
         
            +
            	:Actor(game)
         
     | 
| 
      
 26 
     | 
    
         
            +
            	,mRightSpeed(0.0f)
         
     | 
| 
      
 27 
     | 
    
         
            +
            	,mDownSpeed(0.0f)
         
     | 
| 
      
 28 
     | 
    
         
            +
            {
         
     | 
| 
      
 29 
     | 
    
         
            +
            	// Create an animated sprite component
         
     | 
| 
      
 30 
     | 
    
         
            +
            	AnimSpriteComponent* asc = new AnimSpriteComponent(this);
         
     | 
| 
      
 31 
     | 
    
         
            +
            	std::vector<SDL_Texture*> anims = {
         
     | 
| 
      
 32 
     | 
    
         
            +
            		game->GetTexture("C:\Users\source\repos\code-master\code-master\Chapter02\Assets\Ship01.png"),
         
     | 
| 
      
 33 
     | 
    
         
            +
            		game->GetTexture("C:\Users\source\repos\code-master\code-master\Chapter02\Assets\Ship02.png"),
         
     | 
| 
      
 34 
     | 
    
         
            +
            		game->GetTexture("C:\Users\source\repos\code-master\code-master\Chapter02\Assets\Ship03.png"),
         
     | 
| 
      
 35 
     | 
    
         
            +
            		game->GetTexture("C:\Users\source\repos\code-master\code-master\Chapter02\Assets\Ship04.png"),
         
     | 
| 
      
 36 
     | 
    
         
            +
            	};
         
     | 
| 
      
 37 
     | 
    
         
            +
            	asc->SetAnimTextures(anims);
         
     | 
| 
      
 38 
     | 
    
         
            +
            }
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            -----------------
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            SDL_Texture* Game::GetTexture(const std::string& fileName)
         
     | 
| 
      
 43 
     | 
    
         
            +
            {
         
     | 
| 
      
 44 
     | 
    
         
            +
            	SDL_Texture* tex = nullptr;
         
     | 
| 
      
 45 
     | 
    
         
            +
            	// Is the texture already in the map?
         
     | 
| 
      
 46 
     | 
    
         
            +
            	auto iter = mTextures.find(fileName);
         
     | 
| 
      
 47 
     | 
    
         
            +
            	if (iter != mTextures.end())
         
     | 
| 
      
 48 
     | 
    
         
            +
            	{
         
     | 
| 
      
 49 
     | 
    
         
            +
            		tex = iter->second;
         
     | 
| 
      
 50 
     | 
    
         
            +
            	}
         
     | 
| 
      
 51 
     | 
    
         
            +
            	else
         
     | 
| 
      
 52 
     | 
    
         
            +
            	{
         
     | 
| 
      
 53 
     | 
    
         
            +
            		// Load from file
         
     | 
| 
      
 54 
     | 
    
         
            +
            		SDL_Surface* surf = IMG_Load(fileName.c_str());
         
     | 
| 
      
 55 
     | 
    
         
            +
            		if (!surf)
         
     | 
| 
      
 56 
     | 
    
         
            +
            		{
         
     | 
| 
      
 57 
     | 
    
         
            +
            			SDL_Log("Failed to load texture file %s", fileName.c_str());
         
     | 
| 
      
 58 
     | 
    
         
            +
            			return nullptr;
         
     | 
| 
      
 59 
     | 
    
         
            +
            		}
         
     | 
2
誤字
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -16,6 +16,5 @@ 
     | 
|
| 
       16 
16 
     | 
    
         
             
            Windows10, Visual Studio 2017 Community, C++
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            ### 試したこと
         
     | 
| 
       19 
     | 
    
         
            -
            ・exeファイルを起動した際、なぜかC:\Windows\SysWOW64\やC:\Windows\System32\の中のdllファイルを参照しようとしていたため、x86のdllファイルをSysWOW64内に、x64のdllファイルをSystem32内にコピペしました。しかし結果は変わらずでした。
         
     | 
| 
       20 
19 
     | 
    
         
             
            ・サイトではコピペするdllファイルが, SDL2.dll, SDL2_image.dll, libpng16-16.dllのみでしたが、全てのdllファイルをコピペしました。
         
     | 
| 
       21 
20 
     | 
    
         
             
            ・本からダウンロードしたコードではSDL2とSDL2_imageのヘッダファイル名が違っていたため、自分がダウンロードしたもののヘッダファイル名に変更しました。
         
     | 
1
開発環境の追記
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -13,6 +13,8 @@ 
     | 
|
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            申し訳ありませんがアドバイスをいただければ幸いです。よろしくお願いします。
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
            Windows10, Visual Studio 2017 Community, C++
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       16 
18 
     | 
    
         
             
            ### 試したこと
         
     | 
| 
       17 
19 
     | 
    
         
             
            ・exeファイルを起動した際、なぜかC:\Windows\SysWOW64\やC:\Windows\System32\の中のdllファイルを参照しようとしていたため、x86のdllファイルをSysWOW64内に、x64のdllファイルをSystem32内にコピペしました。しかし結果は変わらずでした。
         
     | 
| 
       18 
20 
     | 
    
         
             
            ・サイトではコピペするdllファイルが, SDL2.dll, SDL2_image.dll, libpng16-16.dllのみでしたが、全てのdllファイルをコピペしました。
         
     |