This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:io'; | |
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MaterialApp(home: MyApp())); | |
| class MyApp extends StatefulWidget { | |
| @override | |
| _MyAppState createState() => _MyAppState(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const value1 = 5; | |
| //const b = DateTime.now(); ---> error | |
| //const value2; | |
| //value2 = 10 ---> harus diinisiasi pada baris yg sama | |
| Class A { | |
| static const a = 5; | |
| // const a = 5; ---> error karena tidak bisa sebagai intance variable | |
| final a, b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Controls auto save of dirty files. Read more about autosave [here](https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save). | |
| // - off: A dirty file is never automatically saved. | |
| // - afterDelay: A dirty file is automatically saved after the configured `files.autoSaveDelay`. | |
| // - onFocusChange: A dirty file is automatically saved when the editor loses focus. | |
| // - onWindowChange: A dirty file is automatically saved when the window loses focus. | |
| "files.autoSave": "off", | |
| // Controls the font size in pixels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| class Cake {} | |
| class Order { | |
| String type; | |
| Order(this.type); | |
| } | |
| void main() { | |
| final controller = StreamController(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Convert node physics bodies into GKPolygonObstacles. | |
| let obstacles = SKNode.obstaclesFromNodePhysicsBodies(self["//obstacles"]) | |
| // Construct a GKObstacleGraph. | |
| let graph = GKObstacleGraph(obstacles: obstacles, bufferRadius: 30.0) | |
| // Connect the TaskBot and PlayerBot via their positions. | |
| let startNode = graph.connectNodeUsingObstacles(taskBot.position) let endNode = graph.connectNodeUsingObstacles(playerBot.position) | |
| // Find the path. | |
| let pathNodes = graph.findPathFromNode(startNode, | |
| toNode: endNode) as! [GKGraphNode2D] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Make some goals, we want to seek the enemy, avoid obstacles, target speed */ | |
| GKGoal *seek = [GKGoal goalToSeekAgent:enemyAgent]; | |
| GKGoal *avoid = [GKGoal goalToAvoidObstacles:obstacles]; | |
| GKGoal *targetSpeed = [GKGoal goalToReachTargetSpeed:50.0f]; | |
| /* Combine goals into behavior | |
| GKBehavior *behavior = [GKBehavior behaviorWithGoals:@[seek,avoid,targetSpeed] | |
| andWeights:@[@1.0,@5.0,@0.5]]; | |
| /* Make an agent - add the behavior to it */ | |
| GKAgent2D *agent = [[GKAgent2D* alloc] init]; | |
| agent.behavior = behavior; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <metal_stdlib> | |
| using namespace metal; #include <SceneKit/scn_metal> | |
| struct custom_vertex_t { | |
| float3 position [[attribute(SCNVertexSemanticPosition)]]; | |
| }; | |
| struct custom_node_t { | |
| float4x4 modelViewProjectionTransform; | |
| }; | |
| struct MyStruct { | |
| float3 direction; |