dev-ui
Piotr Dziwinski 2012-08-13 18:03:12 +02:00
parent 712154bc4f
commit b68dfcd155
5 changed files with 17 additions and 16 deletions

View File

@ -6,7 +6,7 @@ find_package(SDL_image REQUIRED)
find_package(PNG REQUIRED) find_package(PNG REQUIRED)
set(CMAKE_BUILD_TYPE debug) set(CMAKE_BUILD_TYPE debug)
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -Wold-style-cast -std=gnu++0x")
set(ADD_LIBS "") set(ADD_LIBS "")
@ -77,8 +77,9 @@ ${ADD_LIBS}
add_executable(texture_test ${TEXTURE_SOURCES}) add_executable(texture_test ${TEXTURE_SOURCES})
target_link_libraries(texture_test ${LIBS}) target_link_libraries(texture_test ${LIBS})
add_executable(model_test ${MODEL_SOURCES}) # Temporarily disabling because of dependencies on CEngine et al.
target_link_libraries(model_test ${LIBS}) #add_executable(model_test ${MODEL_SOURCES})
#target_link_libraries(model_test ${LIBS})
add_executable(transform_test ${TRANSFORM_SOURCES}) add_executable(transform_test ${TRANSFORM_SOURCES})
target_link_libraries(transform_test ${LIBS}) target_link_libraries(transform_test ${LIBS})

View File

@ -313,7 +313,7 @@ void KeyboardUp(SDLKey key)
void MouseMove(int x, int y) void MouseMove(int x, int y)
{ {
Math::Point currentPos((float)x, (float)y); Math::Point currentPos(static_cast<float>(x), static_cast<float>(y));
static bool first = true; static bool first = true;
if (first || (x < 10) || (y < 10) || (x > 790) || (y > 590)) if (first || (x < 10) || (y < 10) || (x > 790) || (y > 590))
@ -326,8 +326,8 @@ void MouseMove(int x, int y)
return; return;
} }
ROTATION.y = ROTATION_BASE.y + ((float) (x - MOUSE_POS_BASE.x) / 800.0f) * Math::PI; ROTATION.y = ROTATION_BASE.y + (static_cast<float> (x - MOUSE_POS_BASE.x) / 800.0f) * Math::PI;
ROTATION.x = ROTATION_BASE.x + ((float) (y - MOUSE_POS_BASE.y) / 600.0f) * Math::PI; ROTATION.x = ROTATION_BASE.x + (static_cast<float> (y - MOUSE_POS_BASE.y) / 600.0f) * Math::PI;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -378,7 +378,7 @@ int main(int argc, char *argv[])
//SDL_WM_GrabInput(SDL_GRAB_ON); //SDL_WM_GrabInput(SDL_GRAB_ON);
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
Gfx::CGLDevice *device = new Gfx::CGLDevice(); Gfx::CGLDevice *device = new Gfx::CGLDevice(Gfx::GLDeviceConfig());
device->Create(); device->Create();
Init(device); Init(device);

View File

@ -54,7 +54,7 @@ void LoadTexture(Gfx::CGLDevice *device, const std::string &name)
Gfx::Texture tex = GetTexture(name); Gfx::Texture tex = GetTexture(name);
if (tex.valid) if (tex.Valid())
return; return;
CImage img; CImage img;
@ -84,7 +84,7 @@ void Init(Gfx::CGLDevice *device, Gfx::CModelFile *model)
{ {
std::vector<Gfx::ModelTriangle> &triangles = model->GetTriangles(); std::vector<Gfx::ModelTriangle> &triangles = model->GetTriangles();
for (int i = 0; i < (int) triangles.size(); ++i) for (int i = 0; i < static_cast<int>( triangles.size() ); ++i)
{ {
LoadTexture(device, triangles[i].tex1Name); LoadTexture(device, triangles[i].tex1Name);
LoadTexture(device, triangles[i].tex2Name); LoadTexture(device, triangles[i].tex2Name);
@ -131,7 +131,7 @@ void Render(Gfx::CGLDevice *device, Gfx::CModelFile *modelFile)
Gfx::VertexTex2 tri[3]; Gfx::VertexTex2 tri[3];
for (int i = 0; i < (int) triangles.size(); ++i) for (int i = 0; i < static_cast<int>( triangles.size() ); ++i)
{ {
device->SetTexture(0, GetTexture(triangles[i].tex1Name)); device->SetTexture(0, GetTexture(triangles[i].tex1Name));
device->SetTexture(1, GetTexture(triangles[i].tex2Name)); device->SetTexture(1, GetTexture(triangles[i].tex2Name));
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
SDL_WM_SetCaption("Model Test", "Model Test"); SDL_WM_SetCaption("Model Test", "Model Test");
Gfx::CGLDevice *device = new Gfx::CGLDevice(); Gfx::CGLDevice *device = new Gfx::CGLDevice(Gfx::GLDeviceConfig());
device->Create(); device->Create();
Init(device, modelFile); Init(device, modelFile);

View File

@ -160,7 +160,7 @@ int main()
SDL_WM_SetCaption("Texture Test", "Texture Test"); SDL_WM_SetCaption("Texture Test", "Texture Test");
Gfx::CGLDevice *device = new Gfx::CGLDevice(); Gfx::CGLDevice *device = new Gfx::CGLDevice(Gfx::GLDeviceConfig());
device->Create(); device->Create();
Init(device); Init(device);

View File

@ -215,7 +215,7 @@ void KeyboardUp(SDLKey key)
void MouseMove(int x, int y) void MouseMove(int x, int y)
{ {
Math::Point currentPos((float)x, (float)y); Math::Point currentPos(static_cast<float>(x), static_cast<float>(y));
static bool first = true; static bool first = true;
if (first || (x < 10) || (y < 10) || (x > 790) || (y > 590)) if (first || (x < 10) || (y < 10) || (x > 790) || (y > 590))
@ -228,8 +228,8 @@ void MouseMove(int x, int y)
return; return;
} }
ROTATION.y = ROTATION_BASE.y + ((float) (x - MOUSE_POS_BASE.x) / 800.0f) * Math::PI; ROTATION.y = ROTATION_BASE.y + (static_cast<float> (x - MOUSE_POS_BASE.x) / 800.0f) * Math::PI;
ROTATION.x = ROTATION_BASE.x + ((float) (y - MOUSE_POS_BASE.y) / 600.0f) * Math::PI; ROTATION.x = ROTATION_BASE.x + (static_cast<float> (y - MOUSE_POS_BASE.y) / 600.0f) * Math::PI;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -280,7 +280,7 @@ int main(int argc, char *argv[])
//SDL_WM_GrabInput(SDL_GRAB_ON); //SDL_WM_GrabInput(SDL_GRAB_ON);
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
Gfx::CGLDevice *device = new Gfx::CGLDevice(); Gfx::CGLDevice *device = new Gfx::CGLDevice(Gfx::GLDeviceConfig());
device->Create(); device->Create();
Init(device); Init(device);