<commit_before>package native.display;
#if (cpp || neko)

import haxe.Timer;
import native.display.DisplayObjectContainer;
import native.ui.Keyboard;

#if stage3d
import native.display.Stage3D;
#end

import native.events.JoystickEvent;
import native.events.MouseEvent;
import native.events.FocusEvent;
import native.events.KeyboardEvent;
import native.events.SystemEvent;
import native.events.TouchEvent;
import native.events.Event;
import native.geom.Point;
import native.geom.Rectangle;
import native.Lib;
import native.media.SoundChannel;
import native.net.URLLoader;
import native.Loader;
import nme.Vector;


class Stage extends DisplayObjectContainer 
{
   /**
    * Time, in seconds, we wake up before the frame is due.  We then do a
    * "busy wait" to ensure the frame comes at the right time.  By increasing this number,
    * the frame rate will be more constant, but the busy wait will take more CPU.
    * @private
    */
   public static var nmeEarlyWakeup = 0.005;

   public static var OrientationPortrait = 1;
   public static var OrientationPortraitUpsideDown = 2;
   public static var OrientationLandscapeRight = 3;
   public static var OrientationLandscapeLeft = 4;
   public static var OrientationFaceUp = 5;
   public static var OrientationFaceDown = 6;

   public var active(default, null):Bool;
   public var align(get_align, set_align):StageAlign;
   public var displayState(get_displayState, set_displayState):StageDisplayState;
   public var dpiScale(get_dpiScale, null):Float;
   public var focus(get_focus, set_focus):InteractiveObject;
   public var frameRate(default, set_frameRate): Float;
   public var isOpenGL(get_isOpenGL, null):Bool;
   public var onKey:Int -> Bool -> Int -> Int -> Void; 
   public var onQuit:Void -> Void; 
   public var pauseWhenDeactivated:Bool;
   public var quality(get_quality, set_quality):StageQuality;
   public var renderRequest:Void -> Void; 
   public var scaleMode(get_scaleMode, set_scaleMode):StageScaleMode;
   public var stageFocusRect(get_stageFocusRect, set_stageFocusRect):Bool;
   public var stageHeight(get_stageHeight, null):Int;
   public var stageWidth(get_stageWidth, null):Int;

   #if stage3d
   public var stage3Ds:Vector<Stage3D>;
   #end

   private static var efLeftDown = 0x0001;
   private static var efShiftDown = 0x0002;
   private static var efCtrlDown = 0x0004;
   private static var efAltDown = 0x0008;
   private static var efCommandDown = 0x0010;
   private static var efLocationRight = 0x4000;
   private static var efNoNativeClick = 0x10000;
   private static var nmeMouseChanges:Array<String> = [ MouseEvent.MOUSE_OUT, MouseEvent.MOUSE_OVER, MouseEvent.ROLL_OUT, MouseEvent.ROLL_OVER ];
   private static var nmeTouchChanges:Array<String> = [ TouchEvent.TOUCH_OUT, TouchEvent.TOUCH_OVER,   TouchEvent.TOUCH_ROLL_OUT, TouchEvent.TOUCH_ROLL_OVER ];
   private static var sClickEvents = [ "click", "middleClick", "rightClick" ];
   private static var sDownEvents = [ "mouseDown", "middleMouseDown", "rightMouseDown" ];
   private static var sUpEvents = [ "mouseUp", "middleMouseUp", "rightMouseUp" ];

   /** @private */ private var nmeJoyAxisData:#if haxe3 Map <Int, #else IntHash <#end Array <Float>>;
   /** @private */ private var nmeDragBounds:Rectangle;
   /** @private */ private var nmeDragObject:Sprite;
   /** @private */ private var nmeDragOffsetX:Float;
   /** @private */ private var nmeDragOffsetY:Float;
   /** @private */ private var nmeFocusOverObjects:Array<InteractiveObject>;
   /** @private */ private var nmeFramePeriod:Float;
   /** @private */ private var nmeInvalid:Bool;
   /** @private */ private var nmeLastClickTime:Float;
   /** @private */ private var nmeLastDown:Array<InteractiveObject>;
   /** @private */ private var nmeLastRender:Float;
   /** @private */ private var nmeMouseOverObjects:Array<InteractiveObject>;
   /** @private */ private var nmeTouchInfo:#if haxe3 Map <Int, #else IntHash <#end TouchInfo>;
   public function new(inHandle:Dynamic, inWidth:Int, inHeight:Int) 
   {
      super(inHandle, "Stage");

      nmeMouseOverObjects = [];
      nmeFocusOverObjects = [];
      active = true;
      pauseWhenDeactivated = true;

      #if android
      renderRequest = nme_stage_request_render;
      #else
      renderRequest = null;
      #end

      nme_set_stage_handler(nmeHandle, nmeProcessStageEvent, inWidth, inHeight);
      nmeInvalid = false;
      nmeLastRender = 0;
      nmeLastDown = [];
      nmeLastClickTime = 0.0;
      this.frameRate = 100;
      nmeJoyAxisData = new #if haxe3 Map <Int, #else IntHash <#end Array<Float>>();

      #if stage3d
      stage3Ds = new Vector();
      stage3Ds.push(new Stage3D());
      #end
   }

   public static dynamic function getOrientation():Int 
   {
      return nme_stage_get_orientation();
   }

   public static dynamic function getNormalOrientation():Int 
   {
      return nme_stage_get_normal_orientation();
   }
<commit_msg>Add missing nmeTouchInfo initialization<commit_after>package native.display;
#if (cpp || neko)

import haxe.Timer;
import native.display.DisplayObjectContainer;
import native.ui.Keyboard;

#if stage3d
import native.display.Stage3D;
#end

import native.events.JoystickEvent;
import native.events.MouseEvent;
import native.events.FocusEvent;
import native.events.KeyboardEvent;
import native.events.SystemEvent;
import native.events.TouchEvent;
import native.events.Event;
import native.geom.Point;
import native.geom.Rectangle;
import native.Lib;
import native.media.SoundChannel;
import native.net.URLLoader;
import native.Loader;
import nme.Vector;


class Stage extends DisplayObjectContainer 
{
   /**
    * Time, in seconds, we wake up before the frame is due.  We then do a
    * "busy wait" to ensure the frame comes at the right time.  By increasing this number,
    * the frame rate will be more constant, but the busy wait will take more CPU.
    * @private
    */
   public static var nmeEarlyWakeup = 0.005;

   public static var OrientationPortrait = 1;
   public static var OrientationPortraitUpsideDown = 2;
   public static var OrientationLandscapeRight = 3;
   public static var OrientationLandscapeLeft = 4;
   public static var OrientationFaceUp = 5;
   public static var OrientationFaceDown = 6;

   public var active(default, null):Bool;
   public var align(get_align, set_align):StageAlign;
   public var displayState(get_displayState, set_displayState):StageDisplayState;
   public var dpiScale(get_dpiScale, null):Float;
   public var focus(get_focus, set_focus):InteractiveObject;
   public var frameRate(default, set_frameRate): Float;
   public var isOpenGL(get_isOpenGL, null):Bool;
   public var onKey:Int -> Bool -> Int -> Int -> Void; 
   public var onQuit:Void -> Void; 
   public var pauseWhenDeactivated:Bool;
   public var quality(get_quality, set_quality):StageQuality;
   public var renderRequest:Void -> Void; 
   public var scaleMode(get_scaleMode, set_scaleMode):StageScaleMode;
   public var stageFocusRect(get_stageFocusRect, set_stageFocusRect):Bool;
   public var stageHeight(get_stageHeight, null):Int;
   public var stageWidth(get_stageWidth, null):Int;

   #if stage3d
   public var stage3Ds:Vector<Stage3D>;
   #end

   private static var efLeftDown = 0x0001;
   private static var efShiftDown = 0x0002;
   private static var efCtrlDown = 0x0004;
   private static var efAltDown = 0x0008;
   private static var efCommandDown = 0x0010;
   private static var efLocationRight = 0x4000;
   private static var efNoNativeClick = 0x10000;
   private static var nmeMouseChanges:Array<String> = [ MouseEvent.MOUSE_OUT, MouseEvent.MOUSE_OVER, MouseEvent.ROLL_OUT, MouseEvent.ROLL_OVER ];
   private static var nmeTouchChanges:Array<String> = [ TouchEvent.TOUCH_OUT, TouchEvent.TOUCH_OVER,   TouchEvent.TOUCH_ROLL_OUT, TouchEvent.TOUCH_ROLL_OVER ];
   private static var sClickEvents = [ "click", "middleClick", "rightClick" ];
   private static var sDownEvents = [ "mouseDown", "middleMouseDown", "rightMouseDown" ];
   private static var sUpEvents = [ "mouseUp", "middleMouseUp", "rightMouseUp" ];

   /** @private */ private var nmeJoyAxisData:#if haxe3 Map <Int, #else IntHash <#end Array <Float>>;
   /** @private */ private var nmeDragBounds:Rectangle;
   /** @private */ private var nmeDragObject:Sprite;
   /** @private */ private var nmeDragOffsetX:Float;
   /** @private */ private var nmeDragOffsetY:Float;
   /** @private */ private var nmeFocusOverObjects:Array<InteractiveObject>;
   /** @private */ private var nmeFramePeriod:Float;
   /** @private */ private var nmeInvalid:Bool;
   /** @private */ private var nmeLastClickTime:Float;
   /** @private */ private var nmeLastDown:Array<InteractiveObject>;
   /** @private */ private var nmeLastRender:Float;
   /** @private */ private var nmeMouseOverObjects:Array<InteractiveObject>;
   /** @private */ private var nmeTouchInfo:#if haxe3 Map <Int, #else IntHash <#end TouchInfo>;
   public function new(inHandle:Dynamic, inWidth:Int, inHeight:Int) 
   {
      super(inHandle, "Stage");

      nmeMouseOverObjects = [];
      nmeFocusOverObjects = [];
      active = true;
      pauseWhenDeactivated = true;

      #if android
      renderRequest = nme_stage_request_render;
      #else
      renderRequest = null;
      #end

      nme_set_stage_handler(nmeHandle, nmeProcessStageEvent, inWidth, inHeight);
      nmeInvalid = false;
      nmeLastRender = 0;
      nmeLastDown = [];
      nmeLastClickTime = 0.0;
      this.frameRate = 100;
	  nmeTouchInfo = new #if haxe3 Map <Int, #else IntHash <#end TouchInfo>();
      nmeJoyAxisData = new #if haxe3 Map <Int, #else IntHash <#end Array<Float>>();

      #if stage3d
      stage3Ds = new Vector();
      stage3Ds.push(new Stage3D());
      #end
   }

   public static dynamic function getOrientation():Int 
   {
      return nme_stage_get_orientation();
   }

   public static dynamic function getNormalOrientation():Int 
   {
      return nme_stage_get_normal_orientation();
   }

{'fraction_non_alphanumeric': 0.09783263094521373, 'fraction_numerical': 0.012944009632751354, 'mean_word_length': 4.207419017763845, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5489091', 'n_tokens_mistral': 3192, 'n_tokens_neox': 3003, 'n_words': 827}