Example #1
0
func (s *Spoils) Blit(surface *sdl.Surface) {
	switch s.Type {
	case SP_HEART:
		surface.Blit(&sdl.Rect{int16(s.X - s.W/2), int16(s.Y - s.H/2), 0, 0}, IM.Misc[0], nil)
	case SP_UPGRADE:
		surface.FillRect(&sdl.Rect{int16(s.X - s.W/2), int16(s.Y - s.H/2), 10, 10}, uint32(s.Frame))
		s.Frame = s.Frame*s.Frame + 1
		if s.Frame > 0xFFFFFF {
			s.Frame = 0
		}
	}
}
Example #2
0
func BlitHeartsAndTimer(surface *sdl.Surface, antal int, t GameTime) {
	x := 18*BOXSIZE + 10
	y := 5
	for i := 0; i < antal; i++ {
		surface.Blit(&sdl.Rect{int16(x), int16(i*30 + y), 0, 0}, IM.Misc[0], nil)
	}

	max := t.End - t.Start
	nu := t.End - now()
	if nu <= 0 {
		return
	}
	surface.FillRect(&sdl.Rect{int16(x + BOXSIZE), 5 + BOXSIZE, 15, uint16((200 * nu) / max)}, 0xFFFFFF)
}
Example #3
0
func Refresh(surface *sdl.Surface) {
	surface.FillRect(&sdl.Rect{0, 0, SCREENWIDTH, SCREENHEIGHT}, 0x000000)
}
Example #4
0
func (l *ScreenObject) Blit(surface *sdl.Surface) {
	if l == selected {
		surface.FillRect(&sdl.Rect{int16(l.X - l.W/2), int16(l.Y - l.H/2), uint16(l.W), uint16(l.H)}, 0xFFFFFF)
	}
	surface.Blit(&sdl.Rect{int16(l.X - l.W/2), int16(l.Y - l.H/2), 0, 0}, l.image(), nil)
}