Example #1
0
func startWhiteKeysLayer(glctx gl.Context) *whiteKeysLayer {
	layer := whiteKeysLayer{}
	// Create white keys
	layer.keys = make([]models.Key, 0, 0)
	for idx := util.FirstKey; idx <= util.LastKey; idx++ {
		if !util.IsBlackKey(idx) {
			layer.keys = append(layer.keys,
				models.NewWhiteKey(glctx, idx, util.InitSizeEvent, len(layer.keys)))
		}
	}
	return &layer
}
Example #2
0
func startBlackKeysLayer(glctx gl.Context, whiteKeys []models.Key) *blackKeysLayer {
	layer := blackKeysLayer{}
	// Create black keys
	layer.keys = make([]models.Key, 0, 0)
	for idx := util.FirstKey; idx <= util.LastKey; idx++ {
		if util.IsBlackKey(idx) {
			whiteKeyIdx := int((idx - util.FirstKey)) - (1 + len(layer.keys))
			layer.keys = append(layer.keys, models.NewBlackKey(whiteKeys[whiteKeyIdx],
				glctx,
				idx,
				util.InitSizeEvent))
		}
	}
	return &layer
}