Skip to content

Instantly share code, notes, and snippets.

View rdelrosario's full-sized avatar

Rendy Del Rosario rdelrosario

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using SegmentedControlSample.Controls;
using Xamarin.Forms;
namespace SegmentedControlSample
{
public class SegmentedBarControl: ScrollViewWithNotBar
{
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:SegmentedControlSample"
x:Class="SegmentedControlSample.SegmentedControlSamplePage">
<StackLayout Padding="0,5">
<local:SegmentedBarControl ValueChanged="Handle_ValueChanged"
x:Name="segment"
AutoScroll="true"
TextColor="Black"
using Xamarin.Forms;
namespace SegmentedControlSample.Controls
{
public class ScrollViewWithNotBar : ScrollView
{
}
}
using System;
using System.ComponentModel;
using SegmentedControlSample.Controls;
using SegmentedControlSample.Droid.Renderers;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(ScrollViewWithNotBar),typeof(ScrollViewWithNotBarRenderer))]
namespace SegmentedControlSample.Droid.Renderers
{
using System;
using System.ComponentModel;
using SegmentedControlSample.Controls;
using SegmentedControlSample.iOS.Renderers;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(ScrollViewWithNotBar),typeof(ScrollViewWithNotBarRenderer))]
namespace SegmentedControlSample.iOS.Renderers
{
using System;
using System.Collections.Generic;
using System.Linq;
using SegmentedControlSample.Controls;
using Xamarin.Forms;
namespace SegmentedControlSample
{
public class SegmentedBarControl: ContentView
{
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:SegmentedControlSample"
x:Class="SegmentedControlSample.SegmentedControlSamplePage">
<StackLayout Padding="0,5">
<local:SegmentedBarControl ValueChanged="Handle_ValueChanged"
x:Name="segment"
AutoScroll="true"
SCNNode CreatePokemonNodeFromFile(string filePath,string nodeName,SCNVector3 vector)
{
var pScene = SCNScene.FromFile(filePath);
var pokemon = pScene.RootNode.FindChildNode(nodeName, true);
pokemon.Position = vector;
pokemon.PhysicsBody = SCNPhysicsBody.CreateStaticBody();
pokemon.PhysicsBody.PhysicsShape = SCNPhysicsShape.Create(pokemon);
pokemon.PhysicsBody.ContactTestBitMask = (int)BitMaskCategory.Pokeball;
pokemon.PhysicsBody.CategoryBitMask = (int)BitMaskCategory.Pokemon;
return pokemon;
@rdelrosario
rdelrosario / ViewWillAppear.cs
Last active January 18, 2018 03:50
ARKitSample - Pokemon - ViewWillAppear
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
// Create a session configuration
var configuration = new ARWorldTrackingConfiguration {
PlaneDetection = ARPlaneDetection.Horizontal,
LightEstimationEnabled = true
};
SceneView.DebugOptions = ARSCNDebugOptions.ShowFeaturePoints | ARSCNDebugOptions.ShowWorldOrigin;
// Run the view's session
@rdelrosario
rdelrosario / PhysicsDelegate.cs
Created January 18, 2018 04:03
ARKit PhysicsDelegate
public class PhysicsDelegate : SCNPhysicsContactDelegate
{
IList<SCNNode> animatedNodes=new List<SCNNode>();
public override void DidBeginContact(SCNPhysicsWorld world, SCNPhysicsContact contact)
{
var nodeA = contact.NodeA;
var nodeB = contact.NodeB;
SCNNode target = null;
if (nodeA.PhysicsBody.CategoryBitMask == (int)BitMaskCategory.Pokemon)