Skip to content

Pickpoint Results Become Innaccurate If Resize Fails #389

@ParodyGames

Description

@ParodyGames

If the screen tries to set to a too large size resulting in a "OpenGLDevice::setScreenMode -- can't switch to resolution larger than desktop in windowed mode!" error being logged, if you attempt to use pickpoint on scenes to handle user input the coordinates returned will be incorrect and the picked list will not contain the expected elements.

Found this trying to run a project I'm working on from my laptop instead of my desktop. The sprite 'buttons' I had made worked fine on my desktop with a 1024x768 default resolution, but my laptop would throw an error during initialization and attempts to click on the buttons would fail or give a different buttons actions as the pickpoint values were coming back wrong.

Code snippet from script for reference:
`function InputManager::onTouchDown(%this, %touchId, %worldposition)
{

//We assign the list of objects that were hit to variable %picked
%picked = myScene.pickPoint(%worldposition);

//%picked.count is the number of items listed in the %picked variable

for(%i=0; %i<%picked.count; %i++)
{

//When iterating through the list, getWord will return item number %i in variable %picked

  %myobj = getWord(%picked,%i);
  echo(%myobj.Function);
  if(isFunction(%myobj.Function))
  {	  
   call(%myobj.Function,"");
  }
  else if(%myobj.Function !$= "")
  {
   echo("Failed to find function: " @ %myobj.Function);
  }

}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions