예제 #1
0
//export drawCallback
func drawCallback(phase, isBefore C.int, ref unsafe.Pointer) C.int {
	defer func() {
		err := recover()
		if err != nil {
			logging.Errorf("Error during drawCallback: %v", err)
			logging.Error(string(errors.Wrap(err, 1).Stack()))
		}
	}()
	id := (*C.char)(ref)
	data, _ := callbacks[id]
	return C.int(data.callback(DrawingPhase(phase), isBefore == 1, data.ref))
}
예제 #2
0
//export flightLoop
func flightLoop(elapsedSinceLastCall, elapsedTimeSinceLastFlightLoop C.float, counter C.int, ref unsafe.Pointer) C.float {
	defer func() {
		err := recover()
		if err != nil {
			logging.Errorf("Error during flightLoop: %v", err)
			logging.Error(errors.Wrap(err, 1).ErrorStack())
		}
	}()

	id := (*C.char)(ref)
	regData, _ := callbacks[id]
	return C.float(regData.flightLoopData.Callback(float32(elapsedSinceLastCall), float32(elapsedTimeSinceLastFlightLoop), int(counter), regData.flightLoopData.Ref))
}