Compare commits
No commits in common. "10e1ef8107ed0f9bc53c66dac171d84f7a1d98ec" and "fdce0a7d3b03ded25b997f6a0273626ee915b58e" have entirely different histories.
10e1ef8107
...
fdce0a7d3b
2
assets
2
assets
|
@ -1 +1 @@
|
|||
Subproject commit 7b00da4f1971908d389d906fe537bfecd3d03b50
|
||||
Subproject commit 45f65b6a639f3e59d9d1db2a4cf452fe406bd4b2
|
|
@ -4,8 +4,8 @@ name = "12 Autumn above"
|
|||
|
||||
[object.star]
|
||||
sprite = "star::star"
|
||||
position = [0.0, 0.0, 30.0]
|
||||
size = 2000
|
||||
position = [0.0, 0.0, 20.0]
|
||||
size = 1000
|
||||
|
||||
|
||||
[object.earth]
|
||||
|
|
|
@ -11,8 +11,6 @@ pub struct Game {
|
|||
pub player: Ship,
|
||||
pub system: System,
|
||||
pub camera: Camera,
|
||||
paused: bool,
|
||||
pub time_scale: f32,
|
||||
}
|
||||
|
||||
impl Game {
|
||||
|
@ -26,8 +24,6 @@ impl Game {
|
|||
zoom: 500.0,
|
||||
},
|
||||
system: System::new(&ct.systems[0]),
|
||||
paused: false,
|
||||
time_scale: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,17 +39,8 @@ impl Game {
|
|||
self.input.process_scroll(delta, phase)
|
||||
}
|
||||
|
||||
pub fn set_paused(&mut self, pause: bool) {
|
||||
if pause {
|
||||
self.paused = true;
|
||||
self.input.release_all()
|
||||
} else {
|
||||
self.paused = false;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update(&mut self) {
|
||||
let t: f32 = self.last_update.elapsed().as_secs_f32() * self.time_scale;
|
||||
let t: f32 = self.last_update.elapsed().as_secs_f32();
|
||||
|
||||
if self.input.key_thrust {
|
||||
self.player.physicsbody.thrust(50.0 * t);
|
||||
|
|
|
@ -19,12 +19,6 @@ impl InputStatus {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn release_all(&mut self) {
|
||||
self.key_left = false;
|
||||
self.key_right = false;
|
||||
self.key_thrust = false;
|
||||
}
|
||||
|
||||
pub fn process_key(&mut self, state: &ElementState, key: &VirtualKeyCode) {
|
||||
let down = state == &ElementState::Pressed;
|
||||
match key {
|
||||
|
|
|
@ -30,6 +30,7 @@ async fn run(mut game: game::Game) -> Result<()> {
|
|||
event_loop.run(move |event, _, control_flow| {
|
||||
match event {
|
||||
Event::RedrawRequested(window_id) if window_id == gpu.window().id() => {
|
||||
gpu.update();
|
||||
game.update();
|
||||
match gpu.render(&game) {
|
||||
Ok(_) => {}
|
||||
|
@ -53,9 +54,6 @@ async fn run(mut game: game::Game) -> Result<()> {
|
|||
window_id,
|
||||
} if window_id == gpu.window.id() => {
|
||||
match event {
|
||||
WindowEvent::Focused(state) => {
|
||||
game.set_paused(!state);
|
||||
}
|
||||
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
|
||||
WindowEvent::KeyboardInput {
|
||||
input:
|
||||
|
|
|
@ -194,6 +194,8 @@ impl GPUState {
|
|||
self.update_starfield_buffer(game)
|
||||
}
|
||||
|
||||
pub fn update(&mut self) {}
|
||||
|
||||
/// Make a SpriteInstance for each of the game's visible sprites.
|
||||
/// Will panic if SPRITE_INSTANCE_LIMIT is exceeded.
|
||||
///
|
||||
|
|
|
@ -84,7 +84,7 @@ fn vertex_main(
|
|||
fn fragment_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
return textureSampleLevel(
|
||||
texture_array[in.index],
|
||||
sampler_array[0],
|
||||
sampler_array[in.index],
|
||||
in.texture_coords,
|
||||
0.0
|
||||
).rgba;
|
||||
|
|
|
@ -135,7 +135,7 @@ fn fragment_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
|||
|
||||
return textureSampleLevel(
|
||||
texture_array[global.starfield_texture.x],
|
||||
sampler_array[0],
|
||||
sampler_array[global.starfield_texture.x],
|
||||
in.texture_coords,
|
||||
0.0
|
||||
).rgba * vec4<f32>(
|
||||
|
|
|
@ -63,7 +63,7 @@ impl TextureArray {
|
|||
binding: 1,
|
||||
visibility: wgpu::ShaderStages::FRAGMENT,
|
||||
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
|
||||
count: NonZeroU32::new(1),
|
||||
count: NonZeroU32::new(loader.texture_data.len() as u32),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
@ -80,7 +80,7 @@ impl TextureArray {
|
|||
},
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::SamplerArray(&[&sampler]),
|
||||
resource: wgpu::BindingResource::SamplerArray(&[&sampler].repeat(views.len())),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue