Эта программа отлично работает в Microsoft Visual 2010 Express, но я не могу понять, как заставить ее работать в Microsoft Visual 2012 Express. Может кто-нибудь, пожалуйста, скажите мне, почему?
Вот вывод ошибки и предупреждения:
Вот исходный код программы:
#include "stdafx.h"
#include <SFML/Graphics.hpp>
#include <sfml/audio.hpp>
#include <sfml/system.hpp>
#include <iostream>
#include <string>
#include <ctime>
#include <cstdlib>
#include <vector>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <Windows.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif // M_PI
// ...
int _tmain(int argc, _TCHAR* argv[])
{
sf::RenderWindow Window;
Window.create(sf::VideoMode(800, 600), "<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3");
Window.setKeyRepeatEnabled(false);
//sf::Music music;
//if (!music.openFromFile("thinking.ogg"))
// return -1;
//music.play();
//sf::Font MyFont;
//MyFont.loadFromFile("times.ttf");
//
//sf::Text text("Happy Valentines Day!", MyFont);
//text.setCharacterSize(30);
//text.setPosition(200, 340);
//text.setStyle(sf::Text::Bold);
//text.setColor(sf::Color::White);
//
//sf::Text textt("You are so special,", MyFont);
//textt.setCharacterSize(30);
//textt.setPosition(200, 380);
//textt.setStyle(sf::Text::Bold);
//textt.setColor(sf::Color::White);
//
//sf::Text texttt("to me!", MyFont);
//texttt.setCharacterSize(30);
//texttt.setPosition(200, 420);
//texttt.setStyle(sf::Text::Bold);
//texttt.setColor(sf::Color::White);
//sf::Text texty("I", MyFont);
//texty.setCharacterSize(30);
//texty.setPosition(395, 270);
//texty.setStyle(sf::Text::Bold);
//texty.setColor(sf::Color::White);
sf::Time time = sf::seconds(.01);
sf::Time heartone = sf::seconds(1);
sf::Time hearttwo = sf::seconds(2);
sf::Time heartthree= sf::seconds(3);
sf::Time heartfour = sf::seconds(4);
sf::Time winclrone = sf::seconds(6);
sf::Time letterc = sf::seconds(6.5);
sf::Time lettera = sf::seconds(7);
sf::Time letterr = sf::seconds(7.5);
sf::Time letterrr = sf::seconds(8);
sf::Time letteri = sf::seconds(8.5);
sf::Time lettere = sf::seconds(9);
sf::Clock clock;
// first two hearts
int x0 = 800 / 2; // Coordinates of the center of the heart
int y0 = 600 / 2;
int size = 400; // Size of the heart
int r = size / 3;
int xx0 = 800 / 2; // Coordinates of the center of the heart
int yy0 = 600 / 2;
int sizee = 400; // Size of the heart
int rr = sizee / 5;
// hearts 2 - 4
int xxx0 = 800 / 2; // Coordinates of the center of the heart
int yyy0 = 600 / 2;
int sizeee = 400; // Size of the heart
int rrr = sizeee / 10;
int xxxx0 = 800 / 2; // Coordinates of the center of the heart
int yyyy0 = 600 / 2;
int sizeeee = 400; // Size of the heart
int rrrr = sizeeee / 15;
//// hearts 4 - 6
// int xxx0 = 800 / 2; // Coordinates of the center of the heart
// int yyy0 = 600 / 2;
//
// int sizeee = 400; // Size of the heart
//
// int rrr = sizeee / 10;
//
//
// int xxxx0 = 800 / 2; // Coordinates of the center of the heart
// int yyyy0 = 600 / 2;
//
// int sizeeee = 400; // Size of the heart
//
// int rrrr = sizeeee / 7;
//
// first two hearts
// Radius of the curves
int total_curve_vertex_count = 40; // Maximum number of vertices per curve
int total_vertex_count = 80; // Total number of vertices: 30 + 10 + 10 + 30
int total_curve_vertex_countt = 40; // Maximum number of vertices per curve
int total_vertex_countt = 80; // Total number of vertices: 30 + 10 + 10 + 30
// hearts 2 - 4
// Radius of the curves
int total_curve_vertex_counttt = 40; // Maximum number of vertices per curve
int total_vertex_counttt = 80; // Total number of vertices: 30 + 10 + 10 + 30
int total_curve_vertex_countttt = 40; // Maximum number of vertices per curve
int total_vertex_countttt = 80; // Total number of vertices: 30 + 10 + 10 + 30
// first two hearts
struct CurveInfo // Store information for each of the four square curves
{
int vertex_count;
double t0; // Angle origin
double s; // Angle sign: +1 or -1
int cx, cy; // (Relative) coordinates of the center of the curve
}
curve_infos[4] =
{
// Upper-left
{ 3 * total_curve_vertex_count / 4, 0.0, -1.0, -r, -r},
// Lower-left
{ total_curve_vertex_count / 4, 1.5 * M_PI, 1.0, -r, r},
// Lower-right
{ total_curve_vertex_count / 4, M_PI, 1.0, r, r},
// Upper-right
{ 3 * total_curve_vertex_count / 4, 0.5 * M_PI, -1.0, r, -r},
};
struct CurveInfoo // Store information for each of the four square curves
{
int vertex_countt;
double tt0; // Angle origin
double ss; // Angle sign: +1 or -1
int cxx, cyy; // (Relative) coordinates of the center of the curve
}
curve_infoss[4] =
{
// Upper-left
{ 3 * total_curve_vertex_countt / 4, 0.0, -1.0, -rr, -rr},
// Lower-left
{ total_curve_vertex_countt / 4, 1.5 * M_PI, 1.0, -rr, rr},
// Lower-right
{ total_curve_vertex_countt / 4, M_PI, 1.0, rr, rr},
// Upper-right
{ 3 * total_curve_vertex_countt / 4, 0.5 * M_PI, -1.0, rr, -rr},
};
// hearts 2 - 4
struct CurveInfooo // Store information for each of the four square curves
{
int vertex_counttt;
double ttt0; // Angle origin
double sss; // Angle sign: +1 or -1
int cxxx, cyyy; // (Relative) coordinates of the center of the curve
}
curve_infosss[4] =
{
// Upper-left
{ 3 * total_curve_vertex_counttt / 4, 0.0, -1.0, -rrr, -rrr},
// Lower-left
{ total_curve_vertex_counttt / 4, 1.5 * M_PI, 1.0, -rrr, rrr},
// Lower-right
{ total_curve_vertex_counttt / 4, M_PI, 1.0, rrr, rrr},
// Upper-right
{ 3 * total_curve_vertex_counttt / 4, 0.5 * M_PI, -1.0, rrr, -rrr},
};
struct CurveInfoooo // Store information for each of the four square curves
{
int vertex_countttt;
double tttt0; // Angle origin
double ssss; // Angle sign: +1 or -1
int cxxxx, cyyyy; // (Relative) coordinates of the center of the curve
}
curve_infossss[4] =
{
// Upper-left
{ 3 * total_curve_vertex_countttt / 4, 0.0, -1.0, -rrrr, -rrrr},
// Lower-left
{ total_curve_vertex_countttt / 4, 1.5 * M_PI, 1.0, -rrrr, rrrr},
// Lower-right
{ total_curve_vertex_countttt / 4, M_PI, 1.0, rrrr, rrrr},
// Upper-right
{ 3 * total_curve_vertex_countttt / 4, 0.5 * M_PI, -1.0, rrrr, -rrrr},
};
// first two hearts
std::vector<sf::Vector2f> vertices(total_vertex_count);
std::vector<sf::Vector2f> verticess(total_vertex_countt);
int vertex_index = 0;
for(int i = 0; i < 4; i++)
{
CurveInfo& curve_info = curve_infos[i];
int vertex_count = curve_info.vertex_count;
double t0 = curve_info.t0;
double s = curve_info.s;
int cx = x0 + curve_info.cx;
int cy = y0 + curve_info.cy;
for(int j = 0; j < vertex_count; j++)
{
double dt = s * 2.0 * M_PI * j / (total_curve_vertex_count - 1);
int x = cx + r * cos(t0 + dt);
int y = cy + r * sin(t0 + dt);
vertices[vertex_index++] = sf::Vector2f(x, y);
}
}
int vertex_indexx = 0;
for(int ii = 0; ii < 4; ii++)
{
CurveInfoo& curve_infoo = curve_infoss[ii];
int vertex_countt = curve_infoo.vertex_countt;
double tt0 = curve_infoo.tt0;
double ss = curve_infoo.ss;
int cxx = xx0 + curve_infoo.cxx;
int cyy = yy0 + curve_infoo.cyy;
for(int jj = 0; jj < vertex_countt; jj++)
{
double dtt = ss * 2.0 * M_PI * jj / (total_curve_vertex_count - 1);
int x = cxx + rr * cos(tt0 + dtt);
int y = cyy + rr * sin(tt0 + dtt);
verticess[vertex_indexx++] = sf::Vector2f(x, y);
}
}
// hearts 2 - 4
std::vector<sf::Vector2f> verticesss(total_vertex_counttt);
std::vector<sf::Vector2f> verticessss(total_vertex_countttt);
int vertex_indexxx = 0;
for(int iii = 0; iii < 4; iii++)
{
CurveInfooo& curve_infooo = curve_infosss[iii];
int vertex_counttt = curve_infooo.vertex_counttt;
double ttt0 = curve_infooo.ttt0;
double sss = curve_infooo.sss;
int cxxx = xxx0 + curve_infooo.cxxx;
int cyyy = yyy0 + curve_infooo.cyyy;
for(int jjj = 0; jjj < vertex_counttt; jjj++)
{
double dttt = sss * 2.0 * M_PI * jjj / (total_curve_vertex_counttt - 1);
int x = cxxx + rrr * cos(ttt0 + dttt);
int y = cyyy + rrr * sin(ttt0 + dttt);
verticesss[vertex_indexxx++] = sf::Vector2f(x, y);
}
}
int vertex_indexxxx = 0;
for(int iiii = 0; iiii < 4; iiii++)
{
CurveInfoooo& curve_infoooo = curve_infossss[iiii];
int vertex_countttt = curve_infoooo.vertex_countttt;
double tttt0 = curve_infoooo.tttt0;
double ssss = curve_infoooo.ssss;
int cxxxx = xxxx0 + curve_infoooo.cxxxx;
int cyyyy = yyyy0 + curve_infoooo.cyyyy;
for(int jjjj = 0; jjjj < vertex_countttt; jjjj++)
{
double dtttt = ssss * 2.0 * M_PI * jjjj / (total_curve_vertex_countttt - 1);
int x = cxxxx + rrrr * cos(tttt0 + dtttt);
int y = cyyyy + rrrr * sin(tttt0 + dtttt);
verticessss[vertex_indexxxx++] = sf::Vector2f(x, y);
}
}
// first two hearts
// Generate the vertices of the lines primitives
int total_line_count = total_vertex_count - 1;
// Don't duplicate the first and last vertices
int line_vertex_count = 2 * total_vertex_count - 2;
// Generate the vertices of the lines primitives
int total_line_countt = total_vertex_countt - 1;
// Don't duplicate the first and last vertices
int line_vertex_countt = 2 * total_vertex_countt - 2;
// hearts 2 - 4
// Generate the vertices of the lines primitives
int total_line_counttt = total_vertex_counttt - 1;
// Don't duplicate the first and last vertices
int line_vertex_counttt = 2 * total_vertex_counttt - 2;
// Generate the vertices of the lines primitives
int total_line_countttt = total_vertex_countttt - 1;
// Don't duplicate the first and last vertices
int line_vertex_countttt = 2 * total_vertex_countttt - 2;
while(Window.isOpen())
{
sf::Event Event;
while(Window.pollEvent(Event))
{
switch(Event.type)
{
case sf::Event::Closed:
Window.close();
break;
}
}
//name
// Letter C
sf::VertexArray vArrayC(sf::Lines, 16);
vArrayC[0].position = sf::Vector2f(52, 300);
vArrayC[1].position = sf::Vector2f(52, 84);
vArrayC[2].position = sf::Vector2f(52, 84);
vArrayC[3].position = sf::Vector2f(170, 84);
vArrayC[4].position = sf::Vector2f(170, 84);
vArrayC[5].position = sf::Vector2f(170, 100);
vArrayC[6].position = sf::Vector2f(170, 100);
vArrayC[7].position = sf::Vector2f(69, 100);
vArrayC[8].position = sf::Vector2f(69, 100);
vArrayC[9].position = sf::Vector2f(69, 284);
vArrayC[10].position = sf::Vector2f(69, 284);
vArrayC[11].position = sf::Vector2f(170, 284);
vArrayC[12].position = sf::Vector2f(170, 284);
vArrayC[13].position = sf::Vector2f(170, 300);
vArrayC[14].position = sf::Vector2f(170, 300);
vArrayC[15].position = sf::Vector2f(52, 300);
//vArrayC[16].position = sf::Vector2f(200, 100);
//vArrayC[17].position = sf::Vector2f(200, 100);
for(int k = 0; k < 16; k++)
{
int red = rand() % 255;
int green = rand() % 255;
int blue = rand() % 255;
vArrayC[k].color = sf::Color(red, green, blue);
}
//Letter A
sf::VertexArray vArrayA(sf::Lines, 22);
vArrayA[0].position = sf::Vector2f(190, 300);
vArrayA[1].position = sf::Vector2f(240, 84);
vArrayA[2].position = sf::Vector2f(210, 300);
vArrayA[3].position = sf::Vector2f(260, 100);
vArrayA[4].position = sf::Vector2f(190, 300);
vArrayA[5].position = sf::Vector2f(210, 300);
vArrayA[6].position = sf::Vector2f(300, 84);
vArrayA[7].position = sf::Vector2f(350, 300);
vArrayA[8].position = sf::Vector2f(300, 84);
vArrayA[9].position = sf::Vector2f(240, 84);
vArrayA[10].position = sf::Vector2f(330, 300);
vArrayA[11].position = sf::Vector2f(280, 100);
vArrayA[12].position = sf::Vector2f(280, 100);
vArrayA[13].position = sf::Vector2f(260, 100);
vArrayA[14].position = sf::Vector2f(350, 300);
vArrayA[15].position = sf::Vector2f(330, 300);
vArrayA[16].position = sf::Vector2f(235, 200);
vArrayA[17].position = sf::Vector2f(305, 200);
vArrayA[18].position = sf::Vector2f(240, 180);
vArrayA[19].position = sf::Vector2f(300, 180);
vArrayA[20].position = sf::Vector2f(170, 100);
vArrayA[21].position = sf::Vector2f(170, 100);
for(int k = 0; k < 22; k++)
{
int red = rand() % 255;
int green = rand() % 255;
int blue = rand() % 255;
vArrayA[k].color = sf::Color(red, green, blue);
}
// Letter R
sf::VertexArray vArrayR(sf::Lines, 24);
vArrayR[0].position = sf::Vector2f(370, 300);
vArrayR[1].position = sf::Vector2f(390, 300);
vArrayR[2].position = sf::Vector2f(370, 300);
vArrayR[3].position = sf::Vector2f(370, 84);
vArrayR[4].position = sf::Vector2f(390, 300);
vArrayR[5].position = sf::Vector2f(390, 100);
vArrayR[6].position = sf::Vector2f(370, 84);
vArrayR[7].position = sf::Vector2f(470, 84);
vArrayR[8].position = sf::Vector2f(390, 100);
vArrayR[9].position = sf::Vector2f(450, 100);
vArrayR[10].position = sf::Vector2f(450, 170);
vArrayR[11].position = sf::Vector2f(390, 170);
vArrayR[12].position = sf::Vector2f(470, 190);
vArrayR[13].position = sf::Vector2f(410, 190);
vArrayR[14].position = sf::Vector2f(470, 84);
vArrayR[15].position = sf::Vector2f(470, 190);
vArrayR[16].position = sf::Vector2f(450, 100);
vArrayR[17].position = sf::Vector2f(450, 170);
vArrayR[18].position = sf::Vector2f(410, 190);
vArrayR[19].position = sf::Vector2f(470, 300);
vArrayR[20].position = sf::Vector2f(450, 300);
vArrayR[21].position = sf::Vector2f(390, 190);
vArrayR[22].position = sf::Vector2f(470, 300);
vArrayR[23].position = sf::Vector2f(450, 300);
for(int k = 0; k < 24; k++)
{
int red = rand() % 255;
int green = rand() % 255;
int blue = rand() % 255;
vArrayR[k].color = sf::Color(red, green, blue);
}
//Letter r#2
sf::VertexArray vArrayRR(sf::Lines, 24);
vArrayRR[0].position = sf::Vector2f(490, 300);
vArrayRR[1].position = sf::Vector2f(510, 300);
vArrayRR[2].position = sf::Vector2f(490, 300);
vArrayRR[3].position = sf::Vector2f(490, 84);
vArrayRR[4].position = sf::Vector2f(510, 300);
vArrayRR[5].position = sf::Vector2f(510, 100);
vArrayRR[6].position = sf::Vector2f(490, 84);
vArrayRR[7].position = sf::Vector2f(590, 84);
vArrayRR[8].position = sf::Vector2f(510, 100);
vArrayRR[9].position = sf::Vector2f(570, 100);
vArrayRR[10].position = sf::Vector2f(570, 170);
vArrayRR[11].position = sf::Vector2f(510, 170);
vArrayRR[12].position = sf::Vector2f(590, 190);
vArrayRR[13].position = sf::Vector2f(530, 190);
vArrayRR[14].position = sf::Vector2f(590, 84);
vArrayRR[15].position = sf::Vector2f(590, 190);
vArrayRR[16].position = sf::Vector2f(570, 100);
vArrayRR[17].position = sf::Vector2f(570, 170);
vArrayRR[18].position = sf::Vector2f(530, 190);
vArrayRR[19].position = sf::Vector2f(590, 300);
vArrayRR[20].position = sf::Vector2f(570, 300);
vArrayRR[21].position = sf::Vector2f(510, 190);
vArrayRR[22].position = sf::Vector2f(590, 300);
vArrayRR[23].position = sf::Vector2f(570, 300);
for(int k = 0; k < 24; k++)
{
int red = rand() % 255;
int green = rand() % 255;
int blue = rand() % 255;
vArrayRR[k].color = sf::Color(red, green, blue);
}
//Letter I
sf::VertexArray vArrayI(sf::Lines, 24);
vArrayI[0].position = sf::Vector2f(610, 300);
vArrayI[1].position = sf::Vector2f(630, 300);
vArrayI[2].position = sf::Vector2f(610, 300);
vArrayI[3].position = sf::Vector2f(610, 84);
vArrayI[4].position = sf::Vector2f(630, 300);
vArrayI[5].position = sf::Vector2f(630, 84);
vArrayI[6].position = sf::Vector2f(610, 84);
vArrayI[7].position = sf::Vector2f(630, 84);
for(int k = 0; k < 24; k++)
{
int red = rand() % 255;
int green = rand() % 255;
int blue = rand() % 255;
vArrayI[k].color = sf::Color(red, green, blue);
}
//Letter E
sf::VertexArray vArrayE(sf::Lines, 24);
vArrayE[0].position = sf::Vector2f(650, 300);
vArrayE[1].position = sf::Vector2f(770, 300);
vArrayE[2].position = sf::Vector2f(650, 84);
vArrayE[3].position = sf::Vector2f(770, 84);
vArrayE[4].position = sf::Vector2f(650, 300);
vArrayE[5].position = sf::Vector2f(650, 84);
vArrayE[6].position = sf::Vector2f(770, 84);
vArrayE[7].position = sf::Vector2f(770, 105);
vArrayE[8].position = sf::Vector2f(770, 300);
vArrayE[9].position = sf::Vector2f(770, 281);
vArrayE[10].position = sf::Vector2f(770, 105);
vArrayE[11].position = sf::Vector2f(670, 105);
vArrayE[12].position = sf::Vector2f(770, 281);
vArrayE[13].position = sf::Vector2f(670, 281);
vArrayE[14].position = sf::Vector2f(670, 281);
vArrayE[15].position = sf::Vector2f(670, 200);
vArrayE[16].position = sf::Vector2f(670, 105);
vArrayE[17].position = sf::Vector2f(670, 180);
vArrayE[18].position = sf::Vector2f(670, 200);
vArrayE[19].position = sf::Vector2f(740, 200);
vArrayE[20].position = sf::Vector2f(670, 180);
vArrayE[21].position = sf::Vector2f(740, 180);
vArrayE[22].position = sf::Vector2f(740, 200);
vArrayE[23].position = sf::Vector2f(740, 180);
for(int k = 0; k < 24; k++)
{
int red = rand() % 255;
int green = rand() % 255;
int blue = rand() % 255;
vArrayE[k].color = sf::Color(red, green, blue);
}
sf::VertexArray vArrayXX(sf::Lines, 6);
vArrayXX[0].position = sf::Vector2f(395, 300);
vArrayXX[1].position = sf::Vector2f(405, 300);
vArrayXX[2].position = sf::Vector2f(395, 280);
vArrayXX[3].position = sf::Vector2f(405, 280);
vArrayXX[4].position = sf::Vector2f(400, 280);
vArrayXX[5].position = sf::Vector2f(400, 300);
for(int k = 0; k < 6; k++)
{
int red = rand() % 255;
int green = rand() % 255;
int blue = rand() % 255;
vArrayXX[k].color = sf::Color(red, green, blue);
}
// first two hearts
sf::VertexArray vArray(sf::Lines, line_vertex_count);
sf::VertexArray vArrayy(sf::Lines, line_vertex_countt);
int line_index = 0;
vertex_index = 0;
int line_indexx = 0;
vertex_indexx = 0;
for(int k = 0; k < total_line_count; k++)
{
vArray[line_index++].position = vertices[vertex_index++];
vArray[line_index++].position = vertices[vertex_index];
}
for(int k = 0; k < line_vertex_count; k++)
{
int red = rand() % 255;
int green = rand() % 133;
int blue = rand() % 255;
vArray[k].color = sf::Color(red, green, blue);
}
for(int kk = 0; kk < total_line_countt; kk++)
{
vArrayy[line_indexx++].position = verticess[vertex_indexx++];
vArrayy[line_indexx++].position = verticess[vertex_indexx];
}
for(int kk = 0; kk < line_vertex_countt; kk++)
{
int red = rand() % 255;
int green = rand() % 255;
int blue = rand() % 255;
vArrayy[kk].color = sf::Color(red, green, blue);
}
// hearts 2-4
sf::VertexArray vArrayyy(sf::Lines, line_vertex_counttt);
sf::VertexArray vArrayyyy(sf::Lines, line_vertex_countttt);
int line_indexxx = 0;
vertex_indexxx = 0;
int line_indexxxx = 0;
vertex_indexxxx = 0;
for(int kkk = 0; kkk < total_line_counttt; kkk++)
{
vArrayyy[line_indexxx++].position = verticesss[vertex_indexxx++];
vArrayyy[line_indexxx++].position = verticesss[vertex_indexxx];
}
for(int kkk = 0; kkk < line_vertex_counttt; kkk++)
{
int red = rand() % 255;
int green = rand() % 133;
int blue = rand() % 255;
vArrayyy[kkk].color = sf::Color(red, green, blue);
}
for(int kkkk = 0; kkkk < total_line_countttt; kkkk++)
{
vArrayyyy[line_indexxxx++].position = verticessss[vertex_indexxxx++];
vArrayyyy[line_indexxxx++].position = verticessss[vertex_indexxxx];
}
for(int kkkk = 0; kkkk < line_vertex_countttt; kkkk++)
{
int red = rand() % 255;
int green = rand() % 255;
int blue = rand() % 255;
vArrayyyy[kkkk].color = sf::Color(red, green, blue);
}
time = clock.getElapsedTime();
//std::cout << time.asSeconds() << std::endl;
Window.draw(vArrayXX);
if(time >= heartone)
Window.draw(vArrayyyy);
if(time >= hearttwo)
Window.draw(vArrayyy);
if(time >= heartthree)
Window.draw(vArrayy);
if(time >= heartfour)
Window.draw(vArray);
if(time >= winclrone)
Window.clear();
if(time >= letterc)
Window.draw(vArrayC);
if(time >= lettera)
Window.draw(vArrayA);
if(time >= letterr)
Window.draw(vArrayR);
if(time >= letterrr)
Window.draw(vArrayRR);
if(time >= letteri)
Window.draw(vArrayI);
if(time >= lettere)
Window.draw(vArrayE);
if(time >= sf::seconds(10))
std::cout << "Happy Valentines Day! You are so Special to me!" << std::endl;
Window.display();
}
}