Skip to content

Commit

Permalink
game image progress
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDavenport committed May 4, 2024
1 parent 4d4a559 commit 18e83c1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
16 changes: 14 additions & 2 deletions gamercade_app/src/modes/arcade_mode/manage_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ impl ManageGameView {
}
}

// TODO: Add game icon visible here
// TODO: Add ability to upload game icons
pub fn draw(&mut self, context: &mut AppDrawContext) -> bool {
let mut done = false;
let ui = &mut context.ui;
Expand All @@ -48,6 +46,20 @@ impl ManageGameView {
ui.label("Short Description: ");
ui.text_edit_singleline(&mut self.short_description);

// TODO: Add game icon visible here
ui.horizontal(|ui| {
if ui.button("Upload Image").clicked() {
// TODO: Add the upload image logic
};

if ui.button("Delete Image").clicked() {
// TODO: Add delete image "are you sure?" check
// TODO: If sure, delete it
};
});

ui.separator();

ui.label("Long Description: ");
ui.text_edit_singleline(&mut self.long_description);
ui.separator();
Expand Down
10 changes: 10 additions & 0 deletions gamercade_app/src/task_manager/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub enum DownloadStatus {
pub enum HttpRequest {
DownloadRom(WithSession<DownloadRom>),
UploadRom(WithSession<UploadRom>),
DownloadImage(u64),
UploadImage(WithSession<UploadImage>),
}

#[derive(Debug)]
Expand All @@ -62,6 +64,12 @@ pub struct UploadRom {
pub bytes: Vec<u8>,
}

#[derive(Debug)]
pub struct UploadImage {
pub game_id: i64,
pub image: Vec<u8>,
}

impl TaskRequest<HttpManagerState> for HttpRequest {
async fn handle_request(
self,
Expand Down Expand Up @@ -117,6 +125,8 @@ impl TaskRequest<HttpManagerState> for HttpRequest {
.unwrap(),
}
}
HttpRequest::DownloadImage(request) => todo!(),
HttpRequest::UploadImage(request) => todo!(),
}
}
}
Expand Down

0 comments on commit 18e83c1

Please sign in to comment.