This file contains 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 Box2D = require('box2dweb'); | |
const b2World = Box2D.Dynamics.b2World; | |
const b2Vec2 = Box2D.Common.Math.b2Vec2; | |
const b2BodyDef = Box2D.Dynamics.b2BodyDef; | |
const b2Body = Box2D.Dynamics.b2Body; | |
const b2FixtureDef = Box2D.Dynamics.b2FixtureDef; | |
const b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape; | |
export default class Wall { | |
constructor(startPosition, endPosition, world) { |
This file contains 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
module.exports = ` | |
precision highp float; | |
varying vec2 uv; | |
uniform vec4 color; | |
uniform vec2 location; | |
uniform float radius; | |
uniform float ratio; | |
void main () { | |
vec2 currentPosition = vec2(uv.x, uv.y / ratio); |
This file contains 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
05-03 10:56:33.001 665 782 I ReactNativeJS: I`m redrawn! | |
05-03 10:56:33.011 665 782 I ReactNativeJS: I`m redrawn! | |
05-03 10:56:33.021 665 782 I ReactNativeJS: I`m redrawn! | |
05-03 10:56:33.030 665 782 I ReactNativeJS: I`m redrawn! | |
05-03 10:56:33.040 665 782 I ReactNativeJS: I`m redrawn! | |
05-03 10:56:33.049 665 782 I ReactNativeJS: I`m redrawn! | |
05-03 10:56:33.059 665 782 I ReactNativeJS: I`m redrawn! | |
... | |
05-03 10:56:33.934 665 782 I ReactNativeJS: I`m redrawn! | |
05-03 10:56:33.945 665 782 I ReactNativeJS: I`m redrawn! |
This file contains 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 React, {Component} from "react"; | |
import {View, AppRegistry} from "react-native"; | |
import {Surface} from "gl-react-native"; | |
import GL from "gl-react"; | |
const Dimensions = require('Dimensions'); | |
const window = Dimensions.get('window'); | |
import Triangle from './triangle'; | |
export default class GLExample extends Component { | |
render () { |
This file contains 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 Box2D = require('box2dweb'); | |
const b2World = Box2D.Dynamics.b2World; | |
const b2Vec2 = Box2D.Common.Math.b2Vec2; | |
const b2BodyDef = Box2D.Dynamics.b2BodyDef; | |
const b2Body = Box2D.Dynamics.b2Body; | |
const b2FixtureDef = Box2D.Dynamics.b2FixtureDef; | |
const b2CircleShape = Box2D.Collision.Shapes.b2CircleShape; | |
var body; |
This file contains 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 React, {Component} from "react"; | |
import {View, AppRegistry} from "react-native"; | |
import {Surface} from "gl-react-native"; | |
import GL from "gl-react"; | |
const Dimensions = require('Dimensions'); | |
const window = Dimensions.get('window'); | |
import Triangle from './triangle'; | |
export default class GLExample extends Component { | |
render () { |
This file contains 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
module.exports = ` | |
precision highp float; | |
varying vec2 uv; | |
float area(float x1, float y1, float x2, float y2, float x3, float y3) { | |
return abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))); | |
} | |
bool equal(float a, float b) { | |
return abs(a - b) < 0.00001; |
This file contains 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
function openCamera() { | |
camera.openCamera((uri) => { | |
console.log(uri); | |
}, | |
(error) => { | |
console.log(error); | |
} | |
); | |
} |
This file contains 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
class CameraModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context), | |
ActivityEventListener { | |
companion object { | |
private const val CAMERA_REQUEST_CODE = 1 | |
} | |
init { | |
reactApplicationContext.addActivityEventListener(this) | |
} |
This file contains 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
class MainApplication : Application(), ReactApplication { | |
private val mReactNativeHost = object : ReactNativeHost(this) { | |
override fun getUseDeveloperSupport() = BuildConfig.DEBUG | |
override fun getPackages() = listOf( | |
MainReactPackage(), | |
CameraReactPackage() | |
) | |
} |