OSDN Git Service

バージョン番号変更
[gvonavish/GVONavish.git] / GVONavish / GVONavish / GVOWorldMap.cpp
1 #include "stdafx.h"
2 #include <vector>
3
4 #include "GVONavish.h"
5 #include "GVOWorldMap.h"
6
7
8
9
10 bool GVOWorldMap::loadFromFile( const std::wstring& fileNmee )
11 {
12         GVOImage workImage;
13         std::wstring filePath;
14
15         filePath = g_makeFullPath( fileNmee );
16         if ( !workImage.loadFromFile( filePath.c_str() ) ) {
17                 return false;
18         }
19         m_mapImage.copy( workImage );
20         workImage.reset();
21         return true;
22 }
23
24
25 POINT GVOWorldMap::imageCoordFromWorldCoord( const POINT& worldCoord ) const
26 {
27         const double xNormPos = worldCoord.x / (double)k_worldWidth;
28         const double yNormPos = worldCoord.y / (double)k_worldHeight;
29         const POINT worldPosInImage = {
30                 LONG( m_mapImage.width() * xNormPos ),
31                 LONG( m_mapImage.height() * yNormPos )
32         };
33         return worldPosInImage;
34 }