1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-14 16:26:31 -05:00
OpenDiablo2/d2game/d2gamescreen/blizzard_intro.go
gravestench 87d531814d d2datautil.StreamReader refactor
*`StreamReader.Read` methods now return errors

The other edits in this commit are related to cleaning up lint errors
caused by the changes to StreamReader
2021-01-12 10:26:27 -08:00

37 lines
922 B
Go

package d2gamescreen
import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2data/d2video"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2asset"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2screen"
)
// BlizzardIntro represents the Blizzard Intro screen
type BlizzardIntro struct {
asset *d2asset.AssetManager
videoDecoder *d2video.BinkDecoder
}
// CreateBlizzardIntro creates a Blizzard Intro screen
func CreateBlizzardIntro(asset *d2asset.AssetManager) *BlizzardIntro {
return &BlizzardIntro{
asset: asset,
}
}
// OnLoad loads the resources for the Blizzard Intro screen
func (v *BlizzardIntro) OnLoad(loading d2screen.LoadingState) {
videoBytes, err := v.asset.LoadFile("/data/local/video/BlizNorth640x480.bik")
if err != nil {
loading.Error(err)
return
}
loading.Progress(fiftyPercent)
v.videoDecoder, err = d2video.CreateBinkDecoder(videoBytes)
if err != nil {
loading.Error(err)
}
}