incomplete start to porting ui
This commit is contained in:
		
							
								
								
									
										100
									
								
								vacuum_gambit.p8
									
									
									
									
									
								
							
							
						
						
									
										100
									
								
								vacuum_gambit.p8
									
									
									
									
									
								
							| @@ -185,6 +185,10 @@ function call_move(x) | ||||
| end | ||||
|  | ||||
| function updategame() | ||||
|  if primary_ship.xp >= primary_ship.xptarget and lframe - primary_ship.last_xp_frame > 15 then | ||||
|   mode = start_rearm() | ||||
|   return _update60() | ||||
|  end | ||||
|  leveldone = level_frame() | ||||
|  events:vore(new_events) | ||||
|  events:strip(call_move) | ||||
| @@ -960,6 +964,7 @@ player = mknew(ship_m.new{ | ||||
|  -- xp in increments of 0x0.0001 | ||||
|  xp = 0, | ||||
|  xptarget = 0x0.0004, | ||||
|  last_xp_frame = 0, | ||||
|  level = 1, | ||||
|  | ||||
|  -- gun | ||||
| @@ -1751,6 +1756,101 @@ function spawn_spec_gun_at(x, y, gunt) | ||||
|  gun_p:spawn_at(x, y) | ||||
| end | ||||
|  | ||||
| -->8 | ||||
| -- rearm screen | ||||
|  | ||||
| rearm_mode = mknew{ | ||||
|  sel=1, | ||||
|  bfm=1, | ||||
|  crt_frm = 1, | ||||
|  pos=-1, | ||||
| } | ||||
|  | ||||
| crt={-91,-166,-2641,-1441,-23041,23295,-20491,24570} | ||||
|  | ||||
| function rearm_mode:glow_box(x0, y0, x1, y1, c, cf) | ||||
|  for i,v in ipairs{c[1],c[2],c[1],0} do | ||||
|   i -= 1 | ||||
|   rect(x0+i,y0+i,x1-i,y1-i,v) | ||||
|  end | ||||
|  fillp(crt[self.crt_frm&0xff]) | ||||
|  rectfill(x0+4, y0+4, x1-4, y1-4, cf) | ||||
|  fillp() | ||||
| end | ||||
|  | ||||
| function rearm_mode:frame_col(hot) | ||||
|  if (not hot) return {4,10} | ||||
|  if (self.bfm<=16) return {14,7} | ||||
|  return {2,8} | ||||
| end | ||||
|  | ||||
| function easeoutbounce(t) | ||||
| 	local n1=7.5625 | ||||
| 	local d1=2.75 | ||||
|  | ||||
| 	if (t<1/d1) then | ||||
| 		return n1*t*t; | ||||
| 	elseif(t<2/d1) then | ||||
| 		t-=1.5/d1 | ||||
| 		return n1*t*t+.75; | ||||
| 	elseif(t<2.5/d1) then | ||||
| 		t-=2.25/d1 | ||||
| 		return n1*t*t+.9375; | ||||
| 	else | ||||
| 		t-=2.625/d1 | ||||
| 		return n1*t*t+.984375; | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function rearm_mode:pos_frac() | ||||
|  local pos = self.pos | ||||
|  if (not pos) return | ||||
|  if (pos < 0) return 1-easeoutbounce(1+pos) | ||||
|  if (pos > 0) return (1-pos)*(1-pos) | ||||
|  return 0 | ||||
| end | ||||
|  | ||||
| function rearm_mode:init() | ||||
|  --TODO: assign left pane content | ||||
|  --TODO: assign right pane content | ||||
|  -- | ||||
|  -- these will be placeholders | ||||
|  -- until the upgrade deck | ||||
|  -- is a thing that exists | ||||
| end | ||||
|  | ||||
| function rearm_mode:draw() | ||||
|  -- TODO: draw weapon panes | ||||
|  -- TODO: draw rearm pane | ||||
| end | ||||
|  | ||||
| function rearm_mode:update_pos() | ||||
|  local pos = self.pos | ||||
|  if (not pos or pos == 0) return | ||||
|  if (pos < 0) pos = min(pos + 0x0.05, 0) | ||||
|  if pos > 0 then | ||||
|   pos -= 0x0.1 | ||||
|   if (pos <= 0) pos = nil | ||||
|  end | ||||
|  self.pos = pos | ||||
| end | ||||
|  | ||||
| function rearm_mode:update() | ||||
|  self:update_pos() | ||||
|  if not self.pos then | ||||
|   mode = game_mode | ||||
|   return _update60() | ||||
|  end | ||||
| -- TODO: process input | ||||
| end | ||||
|  | ||||
| function do_rearm() | ||||
|  -- TODO: remove this and just | ||||
|  -- use rearm_mode.new() at the | ||||
|  -- call site? | ||||
|  ret = rearm_mode.new() | ||||
| end | ||||
|  | ||||
| __gfx__ | ||||
| 00000000000650000000000000000000bb0b50b59909209200cc0c00000000003b00000082000000e00e8002e00e800200333300002222000000000000000000 | ||||
| 00000000006765000000000000cccc00b50b3055920940220c0000c000bbbb0037000000a2000000e0e8880240e8480403bbbb30028888200000000000000000 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user