Ejemplo n.º 1
0
 public WindowManagerOpenTk(
     AppOpenTk parentApp,
     IDiscardableNode parentDiscardableNode)
 {
     this.parent_          = parentApp;
     this.discardableImpl_ = parentDiscardableNode.CreateChild();
 }
Ejemplo n.º 2
0
 protected EventOwner(IDiscardableNode parentDiscardable)
 {
     this.owner_ =
         IContractFactory.INSTANCE.NewWeakOwner(
             parentDiscardable,
             this.set_);
 }
Ejemplo n.º 3
0
 public EventRelay(IDiscardableNode parentDiscardable)
 {
     this.listener_ =
         IEventFactory.INSTANCE.NewListener(parentDiscardable);
     this.emitter_ =
         IEventFactory.INSTANCE.NewEmitter(parentDiscardable);
 }
Ejemplo n.º 4
0
                public AudioBufferOpenTk(IDiscardableNode parent)
                {
                    this.Id = AL.GenBuffer();

                    this.node_            = parent.CreateChild();
                    this.node_.OnDiscard += _ => this.Destroy_();
                }
Ejemplo n.º 5
0
                public SingleAudioSourceOpenTk(IDiscardableNode parent)
                {
                    this.Id = AL.GenSource();

                    this.node_            = parent.CreateChild();
                    this.node_.OnDiscard += _ => this.Destroy_();
                }
Ejemplo n.º 6
0
        public AudioOpenTk(IDiscardableNode parent)
        {
            this.node_ = parent.CreateChild();
            this.node_.Using(new AudioContext());

            this.factory_ = new AudioFactoryOpenTk(this.node_);
        }
Ejemplo n.º 7
0
                public ProactiveAudioStreamSourceOpenTk(
                    IDiscardableNode parent,
                    Action <byte[]> populateFunc,
                    int channels,
                    int bytesPerSample,
                    int frequency,
                    int numBuffers,
                    int bufferSize)
                {
                    this.node_            = parent.CreateChild();
                    this.node_.OnDiscard += _ => this.Destroy_();

                    this.sourceId_ = AL.GenSource();

                    this.bufferIds_    = AL.GenBuffers(numBuffers).ToImmutableArray();
                    this.populateFunc_ = populateFunc;

                    this.format_ = PcmHelperOpenTk.GetPcmFormat(channels, bytesPerSample);

                    this.frequency_  = frequency;
                    this.bufferSize_ = bufferSize;

                    this.currentBufferIndex_ =
                        new CircularRangedInt(0, 0, numBuffers);

                    // TODO: Delay this until the observable has returned some value. Stream
                    // should remember stop/play/paused state as expected in the meantime.
                    this.readyBuffersIds_ = new Queue <int>();
                    foreach (var bufferId in this.bufferIds_)
                    {
                        this.readyBuffersIds_.Enqueue(bufferId);
                    }
                    this.PopulateAndQueueReadyBuffers_();
                }
Ejemplo n.º 8
0
 public void BeforeEachDiscardableTest()
 {
     this.discardableFactory_ =
         new DiscardableNodeFactoryImpl(
             rootDiscardable =>
             this.OnRootDiscardableCreated(
                 this.rootDiscardable_ = rootDiscardable));
 }
            public ContractPointerOwnerImpl(
                IDiscardableNode parentDiscardable,
                IContractPointerSet <T> set)
            {
                this.discardableImpl_            = parentDiscardable.CreateChild();
                this.discardableImpl_.OnDiscard += _ => this.BreakAll();

                this.set_ = set;
            }
Ejemplo n.º 10
0
            public AppNodeImpl(IDiscardableNode parentDiscardableNode)
            {
                this.discardableImpl_            = parentDiscardableNode.CreateChild();
                this.discardableImpl_.OnDiscard += _ => this.Discard_();

                this.listener_ =
                    IEventFactory.INSTANCE.NewListener(this.discardableImpl_);
                this.downwardRelay_ =
                    IEventFactory.INSTANCE.NewRelay(this.discardableImpl_);

                this.forOnTickMethod_ = new ForOnTickMethodImpl(this);
            }
Ejemplo n.º 11
0
                public WindowOpenTk(
                    IDiscardableNode parentDiscardable,
                    IWindowArgs args,
                    InputOpenTk input,
                    Action onClose)
                {
                    this.discardableImpl_            = parentDiscardable.CreateChild();
                    this.discardableImpl_.OnDiscard += _ => this.Discard_();

                    var initialWidth  = args.Dimensions.Width;
                    var initialHeight = args.Dimensions.Height;

                    this.nativeWindow_ = new NativeWindow(initialWidth,
                                                          initialHeight,
                                                          "SimpleGame",
                                                          GameWindowFlags.Default,
                                                          GraphicsMode.Default,
                                                          DisplayDevice.Default);

                    this.AttachToNativeInputEvents_(input);

                    this.nativeWindow_.Closed += (_, _2) => onClose();

                    var windowInfo = this.nativeWindow_.WindowInfo;

                    this.glContext_ = new GraphicsContext(GraphicsMode.Default,
                                                          windowInfo,
                                                          1,
                                                          0,
                                                          GraphicsContextFlags.Default);
                    this.glContext_.MakeCurrent(windowInfo);
                    ((IGraphicsContextInternal)this.glContext_).LoadAll();

                    //this.glContext_.SwapInterval = 0;

                    this.windowBoundingBox_ =
                        new MutableBoundingBox <int>(0, 0, initialWidth, initialHeight);
                    var windowTopLeft    = this.windowBoundingBox_.TopLeft;
                    var windowDimensions = this.windowBoundingBox_.Dimensions;

                    this.nativeWindow_.Move += (_, _2) =>
                                               (windowTopLeft.X,
                                                windowTopLeft.Y) =
                        (this.nativeWindow_.X, this.nativeWindow_.Y);
                    this.nativeWindow_.Resize += (_, _2) =>
                                                 (windowDimensions.Width, windowDimensions.Height) =
                        (this.nativeWindow_.Width, this.nativeWindow_.Height);

                    this.viewport_.Push(new AggregationBoundingBox <int>(
                                            new ImmutableVector2 <int>(0, 0),
                                            this.windowBoundingBox_.Dimensions));
                }
Ejemplo n.º 12
0
        public AppOpenTk()
        {
            new DiscardableNodeFactoryImpl(
                root => this.rootDiscardableNode_ = root);

            this.Audio          = new AudioOpenTk(this.rootDiscardableNode_);
            this.Instantiator   = new InstantiatorImpl(this.rootDiscardableNode_);
            this.windowManager_ =
                new WindowManagerOpenTk(this, this.rootDiscardableNode_);

            this.root_ = this.Instantiator.NewRoot();

            var settings = Settings.Load();

            this.ticker_ =
                RecurrentCaller.FromFrequency(settings.Framerate,
                                              this.CompileTick_());
        }
Ejemplo n.º 13
0
 public IEventListener NewListener(IDiscardableNode parentDiscardable)
 => new EventListener(parentDiscardable);
Ejemplo n.º 14
0
 public EventListener(IDiscardableNode parentDiscardable)
     : base(parentDiscardable)
 {
 }
Ejemplo n.º 15
0
 public EventEmitter(IDiscardableNode parentDiscardable)
     : base(parentDiscardable)
 {
 }
Ejemplo n.º 16
0
 public IEventEmitter NewEmitter(IDiscardableNode parentDiscardable)
 => new EventEmitter(parentDiscardable);
Ejemplo n.º 17
0
 protected EventSource(IDiscardableNode parentDiscardable)
     : base(parentDiscardable)
 {
 }
Ejemplo n.º 18
0
 public AudioFactoryOpenTk(IDiscardableNode parent)
 {
     this.node_ = parent.CreateChild();
 }
Ejemplo n.º 19
0
 protected override void OnRootDiscardableCreated(
     IDiscardableNode rootDiscardable)
 => INSTANTIATOR = new InstantiatorImpl(rootDiscardable);
Ejemplo n.º 20
0
 public IStrongContractPointerOwner <T> NewStrongOwner <T>(
     IDiscardableNode parentDiscardable,
     IContractPointerSet <T> set)
 => new StrongContractPointerOwner <T>(parentDiscardable, set);
Ejemplo n.º 21
0
 public IStrongContractPointerOwner <T> NewStrongOwner <T>(
     IDiscardableNode parentDiscardable)
 => this.NewStrongOwner(parentDiscardable,
                        new DefaultContractPointerSet <T>());
Ejemplo n.º 22
0
 public StrongContractPointerOwner(
     IDiscardableNode parentDiscardable,
     IContractPointerSet <T> set) : base(parentDiscardable, set)
 {
 }
Ejemplo n.º 23
0
 public void SetParent(IDiscardableNode parent)
 => this.SetParent_(Expect.That(parent).AsA <DiscardableNodeImpl>());
Ejemplo n.º 24
0
 protected abstract void OnRootDiscardableCreated(
     IDiscardableNode rootDiscardable);
Ejemplo n.º 25
0
 public IEventRelay NewRelay(IDiscardableNode parentDiscardable)
 => new EventRelay(parentDiscardable);
Ejemplo n.º 26
0
 protected override void OnRootDiscardableCreated(
     IDiscardableNode rootDiscardable)
   => this.rootDiscardable_ = rootDiscardable;
Ejemplo n.º 27
0
 public InstantiatorImpl(IDiscardableNode parentDiscardable)
 {
     this.discardableImpl_ = parentDiscardable.CreateChild();
 }
 public IWeakContractPointerOwner <T> NewWeakOwner <T>(
     IDiscardableNode parentDiscardable,
     IContractPointerSet <T> set)
 => new WeakContractPointerOwner <T>(parentDiscardable, set);