本文整理汇总了C++中Input::GetMouseY方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::GetMouseY方法的具体用法?C++ Input::GetMouseY怎么用?C++ Input::GetMouseY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::GetMouseY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sourisSurElement
bool Controller::sourisSurElement(const Input & input, Element * e)const {
if (input.GetMouseX() < e->getPosX() - DIMENSION_SPRITE)
return false;
else if (input.GetMouseX() > e->getPosX() + DIMENSION_SPRITE)
return false;
else if (input.GetMouseY() < e->getPosY() - DIMENSION_SPRITE)
return false;
else if (input.GetMouseY() > e->getPosY() + DIMENSION_SPRITE)
return false;
return true;
}
示例2: Update
void Gui::Update(const Input& input)
{
if (m_show)
{
m_tweaker->Update();
if (input.IsMouseMovedThisTick())
{
TwMouseMotion(input.GetMouseX(), input.GetMouseY());
}
else if (input.IsLeftMousePressedThisTick())
{
TwMouseButton(TW_MOUSE_PRESSED, TW_MOUSE_LEFT);
}
else if (input.IsLeftMouseReleasedThisTick())
{
TwMouseButton(TW_MOUSE_RELEASED, TW_MOUSE_LEFT);
}
}
}
示例3: Input_getMouseY
static VALUE Input_getMouseY(VALUE vSelf) {
// Get C++ object pointer from vSelf
Input *pSelf;
Data_Get_Struct(vSelf, Input, pSelf);
return INT2FIX(pSelf->GetMouseY());
}
示例4: main
int main(){
try{
ILogger::Init();
Settings::Call().Parse();
ResourceManager::Call().AddPath("Data/shaders", "Shader");
ResourceManager::Call().AddPath("Data/textures", "Image");
{
Window myWindow;
Image Crate;
Texture CrateTexture;
Text FPSText, MousePosText;
Clock FrameClock, FpsClock;
Input myInput;
myInput.Init(myWindow);
Renderer& myRenderer = Renderer::Call();
myRenderer.Init(myWindow);
Crate.LoadFromFile("crate.jpg");
CrateTexture.LoadFromImage(Crate);
Light l;
l.SetPosition(Vector3F(1,3,1.5));
l.SetDiffuse(Color(1.f,1.f,1.f));
l.SetRange(8);
Shader ColorShader;
ColorShader.Compile("shaderColor.vs", "shaderColor.fs");
ColorShader.Bind();
ColorShader.SendColor("ambientColor", myRenderer.GetSpecifications().mAmbientColor);
ColorShader.SendFloat("constantAtt", l.GetAttenuationConstant());
ColorShader.SendFloat("linearAtt", l.GetAttenuationLinear());
ColorShader.SendFloat("quadraticAtt", l.GetAttenuationQuadratic());
ColorShader.SendFloat("range", l.GetRange());
ColorShader.SendVector3("lightPosition", l.GetPosition());
ColorShader.SendColor("lightColor", l.GetDiffuse());
ColorShader.UnBind();
Object obj1;
obj1.MakeCube("cube", ColorShader);
obj1.GetMaterial().mAmbient = Color(0.f, 0.08f, 0.08f);
obj1.GetMaterial().mDiffuse = Color(0.f, 0.8f, 0.8f);
obj1.GetMaterial().mSpecular = Color(0.0f, 0.5f, 0.5f);
obj1.GetMaterial().mShininess = 50.f;
Camera cam;
cam.LookAt(Vector3F(0.5f,0,1), Vector3F(-2.5f,2,4));
FPSText.SetSize(12);
FPSText.SetPosition(10,10);
MousePosText.SetSize(12);
MousePosText.SetPosition(10,22);
while(myWindow.IsOpened()){
ElapsedTime = FrameClock.GetElapsedTime();
FrameClock.Reset();
if(FpsClock.GetElapsedTime() > 1.f){
FPSText.SetText(String(1.f/ElapsedTime));
FpsClock.Reset();
}
while(myInput.GetEvent()){
if(myInput.GetEventType() == sf::Event::Closed)
myWindow.Close();
if(myInput.IsKeyHit(Space))
if(!paused){
paused = true;
FrameClock.Pause();
}else{
paused = false;
FrameClock.Resume();
}
}
MousePosText.SetText(String("X : ")+myInput.GetMouseX()+" Y : "+myInput.GetMouseY());
MousePosText.Draw();
FPSText.Draw();
obj1.Draw();
myRenderer.BeginScene(myRenderer.GetSpecifications().mAmbientColor);
myRenderer.Render();
myRenderer.EndScene();
}
}
}catch(Exception e){
std::cout << e.what() << std::endl;
system("PAUSE");
}
Renderer::Kill();
ResourceManager::Kill();
Settings::Kill();
ILogger::Kill();
//.........这里部分代码省略.........