JA_Load_Obj_On_Screen.m 768 B

12345678910111213141516171819202122232425
  1. function [Ob, Par] = JA_Load_Obj_On_Screen(Par, Ob)
  2. % it puts on the screen all the objects, in the CURRENT position
  3. % depending on their nature, different 'Screen' parameters have to be used
  4. % (FillRect for rectangular objects and FillOval for oval objects)
  5. objects_names = fieldnames(Ob);
  6. for x = 1:length(objects_names)
  7. if strcmp(Ob.(objects_names{x}).type, 'square')
  8. % choose where to put the center of the object by defining its
  9. % dimensions
  10. Screen('FillRect', Par.window, Ob.(objects_names{x}).color, Ob.(objects_names{x}).dimension);
  11. end
  12. if strcmp(Ob.(objects_names{x}).type, 'circle')
  13. Screen('FillOval', Par.window, Ob.(objects_names{x}).color, Ob.(objects_names{x}).dimension);
  14. end
  15. end
  16. end