Exemple #1
0
 public static Offset <BackpackLights> CreateBackpackLights(FlatBufferBuilder builder,
                                                            uint triggerTime_ms       = 0,
                                                            uint durationTime_ms      = 0,
                                                            VectorOffset FrontOffset  = default(VectorOffset),
                                                            VectorOffset MiddleOffset = default(VectorOffset),
                                                            VectorOffset BackOffset   = default(VectorOffset))
 {
     builder.StartObject(5);
     BackpackLights.AddBack(builder, BackOffset);
     BackpackLights.AddMiddle(builder, MiddleOffset);
     BackpackLights.AddFront(builder, FrontOffset);
     BackpackLights.AddDurationTimeMs(builder, durationTime_ms);
     BackpackLights.AddTriggerTimeMs(builder, triggerTime_ms);
     return(BackpackLights.EndBackpackLights(builder));
 }
        /// <summary>
        /// This is used to translate a backpack lights animation struct into
        /// the internal format used for animation
        /// </summary>
        /// <param name="bl">The backpack lights struct</param>
        /// <param name="Front">The front LED animation frame</param>
        /// <param name="Middle">The middle LED animation frame</param>
        /// <param name="Back">The back LED animation frame</param>
        /// <returns>duration</returns>
        static uint From(Anki.VectorAnim.BackpackLights bl, out LightFrame Front, out LightFrame Middle, out LightFrame Back)
        {
            // Ignore alpha
            var frontColor      = Color.FromArgb(255, (byte)(255 * bl.Front(0)), (byte)(255 * bl.Front(1)), (byte)(255 * bl.Front(2)));
            var middleColor     = Color.FromArgb(255, (byte)(255 * bl.Middle(0)), (byte)(255 * bl.Middle(1)), (byte)(255 * bl.Middle(2)));
            var backColor       = Color.FromArgb(255, (byte)(255 * bl.Back(0)), (byte)(255 * bl.Back(1)), (byte)(255 * bl.Back(2)));
            var triggerTime_ms  = bl.TriggerTimeMs;
            var durationTime_ms = bl.DurationTimeMs;

            // Convert each of these to their own frame
            Front  = new LightFrame(triggerTime_ms, durationTime_ms, frontColor);
            Middle = new LightFrame(triggerTime_ms, durationTime_ms, middleColor);
            Back   = new LightFrame(triggerTime_ms, durationTime_ms, backColor);
            return(triggerTime_ms + durationTime_ms);
        }
Exemple #3
0
 public static BackpackLights GetRootAsBackpackLights(ByteBuffer _bb, BackpackLights obj)
 {
     return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb));
 }