2020-06-13 20:36:20 -04:00
|
|
|
package d2gamescreen
|
2020-01-31 23:18:11 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2data/d2video"
|
2020-02-01 18:55:56 -05:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2asset"
|
2020-06-24 18:46:03 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2screen"
|
2020-01-31 23:18:11 -05:00
|
|
|
)
|
|
|
|
|
2020-07-06 20:13:55 -04:00
|
|
|
// BlizzardIntro represents the Blizzard Intro screen
|
2020-01-31 23:18:11 -05:00
|
|
|
type BlizzardIntro struct {
|
2020-09-12 16:51:30 -04:00
|
|
|
asset *d2asset.AssetManager
|
2020-01-31 23:18:11 -05:00
|
|
|
videoDecoder *d2video.BinkDecoder
|
|
|
|
}
|
|
|
|
|
2020-07-06 20:13:55 -04:00
|
|
|
// CreateBlizzardIntro creates a Blizzard Intro screen
|
2020-09-12 16:51:30 -04:00
|
|
|
func CreateBlizzardIntro(asset *d2asset.AssetManager) *BlizzardIntro {
|
|
|
|
return &BlizzardIntro{
|
|
|
|
asset: asset,
|
|
|
|
}
|
2020-01-31 23:18:11 -05:00
|
|
|
}
|
|
|
|
|
2020-07-06 20:13:55 -04:00
|
|
|
// OnLoad loads the resources for the Blizzard Intro screen
|
2020-06-24 18:46:03 -04:00
|
|
|
func (v *BlizzardIntro) OnLoad(loading d2screen.LoadingState) {
|
2020-09-12 16:51:30 -04:00
|
|
|
videoBytes, err := v.asset.LoadFile("/data/local/video/BlizNorth640x480.bik")
|
2020-02-08 21:02:37 -05:00
|
|
|
if err != nil {
|
2020-06-24 18:46:03 -04:00
|
|
|
loading.Error(err)
|
|
|
|
return
|
2020-01-31 23:18:11 -05:00
|
|
|
}
|
2020-09-12 16:25:09 -04:00
|
|
|
|
2020-07-18 09:54:10 -04:00
|
|
|
loading.Progress(fiftyPercent)
|
2020-01-31 23:18:11 -05:00
|
|
|
|
2021-01-11 20:23:43 -05:00
|
|
|
v.videoDecoder, err = d2video.CreateBinkDecoder(videoBytes)
|
|
|
|
if err != nil {
|
|
|
|
loading.Error(err)
|
|
|
|
}
|
2020-01-31 23:18:11 -05:00
|
|
|
}
|