本文整理汇总了C++中Coord::SetY方法的典型用法代码示例。如果您正苦于以下问题:C++ Coord::SetY方法的具体用法?C++ Coord::SetY怎么用?C++ Coord::SetY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coord
的用法示例。
在下文中一共展示了Coord::SetY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
int mainmain::Execute()
{
static int Frames = 0;
static int T0 = 0;
static int T1 = 0;
char sfps[8];
if(Init() == false && Running == false )
return -1;
Audio *m_pAudio;
Map map;
if(m_pAudio->Init() == 0 && Running == false )
return -1;
map.Open("data/maps/first.m","first");
Running = true;
SDL_Color clr;
Coord dest;
dest.SetX(4);
dest.SetY(4);
clr.r = 255;
clr.g = 255;
clr.b = 0;
int mouseposx=0;
int mouseposy=0;
SDL_Color clr2;
clr2.r = 255;
clr2.g = 255;
clr2.b = 255;
Coord dest2;
dest2.SetX(16);
dest2.SetY(16);
GLuint cursor;
image=LoadImage("data/images/kolobok.bmp",1);
cursor=LoadImage("data/gui_cursor.png",0);
Coord CirclePos;
Coord Camera;
Uint8 *keys;
char fpss[10];
CirclePos.SetX(2);
CirclePos.SetY(2);
CirclePos.SetW(2);
CirclePos.SetH(2);
Camera.SetW(16);
Camera.SetH(16);
Camera.SetX(8);
Camera.SetY(8);
Sound* sound=new Sound;
sound->Load("1.wav");
sound->Play(1, 100);
bool playing=true;
//glTranslatef(-1.5f,0.0f,-6.0f);
while(Running)
{
SDL_GetMouseState(&mouseposx, &mouseposy);
//OnCleanUp()
//SDL_FillRect(Screen, NULL, SDL_MapRGB(Screen->format, 0, 0, 0));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// очистка Экрана и буфера глубины
glLoadIdentity();
// Сброс просмотра
glTranslatef( -1.0f, 1.0f, -3.4f );
DrawIMG(image, CirclePos.x,CirclePos.y,CirclePos.w,CirclePos.h);
//OnRender()
map.OnRender(Screen,Camera.x,Camera.y,Camera.w,Camera.h);
m_pText->print_ttf("SDL_ttf example", "data/courier.ttf", 1, clr, dest.x, dest.y,false,false);
m_pText->print_ttf(sfps , "data/courier.ttf", 0.3, clr2, dest2.x, dest2.y,true,true);
DrawIMG(cursor, pixtogl(mouseposx,false),pixtogl(mouseposy,true),localtogl(1, false),localtogl(1, true) );
SDL_GL_SwapBuffers( );
if(!sound->IsPlaying() && playing){
playing=false;
sound->UnLoad();
}
SDL_Flip(Screen);
SDL_Event Event;
while(SDL_PollEvent(&Event))
{
//OnEvent
if (Event.type == SDL_QUIT)
{
Running = false;
}
}
//OnKeyDown()
keys = SDL_GetKeyState(NULL);
if(keys[SDLK_UP]){ CirclePos.SetY(CirclePos.GetY()-(timer-lasttimer)*5);
Camera.SetY(Camera.GetY()-(timer-lasttimer)*5); }
if(keys[SDLK_DOWN]){ CirclePos.SetY(CirclePos.GetY()+(timer-lasttimer)*5);
Camera.SetY(Camera.GetY()+(timer-lasttimer)*5); }
if(keys[SDLK_LEFT]){ CirclePos.SetX(CirclePos.GetX()-(timer-lasttimer)*5);
Camera.SetX(Camera.GetX()-(timer-lasttimer)*5); }
if(keys[SDLK_RIGHT]){ CirclePos.SetX(CirclePos.GetX()+(timer-lasttimer)*5);
Camera.SetX(Camera.GetX()+(timer-lasttimer)*5); }
Frames++;
{
int t = SDL_GetTicks();
lasttimer=timer;
timer += (t - T1) / 1000.0;
T1 = t;
//.........这里部分代码省略.........