downgrades people, downgrades (decided to scrap the screenshot feature)

This commit is contained in:
magnusKue
2024-10-13 18:11:08 +02:00
parent fabafa87e0
commit 64a4101363
7 changed files with 2 additions and 59 deletions
+1 -17
View File
@@ -83,21 +83,5 @@ emulator_input = [
["EXIT", "ESCAPE"],
["LOAD", "L" ],
["SAVE", "O" ],
["HONK", "H" ],
["SCREENSHOT", "U" ]
["HONK", "H" ]
]
# The path where to save your screenshots.
# Make sure this is a valid and relative path!
screenshot_path = ""
# The desired fileformat for your screenshot.
# Options are [".jpg", ".png"]
screenshot_format = ".jpg"
# Set this to true if you want the ui
# (pause menu, fps counter etc) to show
# up in your screenshots. If set to false
# only the emulators framebuffer will be
# captured.
capture_ui = true
-4
View File
@@ -7,7 +7,6 @@ use std::process;
use crate::savestates;
use crate::config;
use crate::screenshot;
use crate::graphics::GraphicsManager;
use crate::input::InputManager;
@@ -160,9 +159,6 @@ impl AppManager {
"SAVE" => {
self.emu_savestate = savestates::make_save(&self.emulator);
},
"SCREENSHOT" => {
screenshot::take_screenshot(&self.config, &self.emulator);
}
_ => {
print!("ERROR: Unimplemented ACTION");
}
+1 -7
View File
@@ -3,7 +3,7 @@ use std::fs;
use std::process;
pub const VALID_ACTIONS: [&str; 8] = [
pub const VALID_ACTIONS: [&str; 7] = [
"PAUSE",
"RESET",
"NEXT_THEME",
@@ -11,7 +11,6 @@ pub const VALID_ACTIONS: [&str; 8] = [
"LOAD",
"SAVE",
"HONK",
"SCREENSHOT"
];
#[derive(Deserialize, Debug)]
@@ -30,10 +29,6 @@ pub struct Config {
pub game_input: Vec<String>,
pub emulator_input: Vec<Vec<String>>,
pub screenshot_format: String,
pub screenshot_path: String,
pub capture_ui: bool,
}
pub fn read_config() -> Config {
@@ -65,7 +60,6 @@ pub fn get_readable_action_name(action: &str) -> &str {
"HONK" => { "honk" },
"RESET" => { "reset the game" },
"PAUSE" => { "continue" }
"SCREENSHOT" => { "take a screenshot" },
_ => {
println!("ERROR: Invalid action");
"INVALID ACTION"
-1
View File
@@ -1,7 +1,6 @@
mod app;
mod audio;
mod screenshot;
mod savestates;
mod config;
-30
View File
@@ -1,30 +0,0 @@
use chip8_core::Emu;
use chrono::Utc;
use std::ffi::CString;
use raylib::ffi::TakeScreenshot;
use crate::config::Config;
pub fn take_screenshot(config: &Config, emulator: &Emu) {
let path = create_path(config);
println!("{}",path);
if config.capture_ui {
println!("INFO: Capturing UI!");
// save whole window
let c_path = CString::new(path).expect("ERROR: Creating cString from path failed");
unsafe {
TakeScreenshot(c_path.as_ptr());
}
}
else {
// save screenbuffer only
}
}
pub fn create_path(config: &Config) -> String {
let now = Utc::now();
let ss_title = now.format("%Y-%m-%d_at_%H:%M:%S").to_string() + &config.screenshot_format;
ss_title
}
BIN
View File
Binary file not shown.
Binary file not shown.