mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'songtronix/fix-rich-presence' into 'master'
Fix discord rich presence See merge request veloren/veloren!543
This commit is contained in:
commit
2a62314dd1
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3690,7 +3690,6 @@ dependencies = [
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msgbox 0.2.0 (git+https://github.com/bekker/msgbox-rs.git)",
|
||||
"num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"portpicker 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rodio 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -7,7 +7,7 @@ default-run = "veloren-voxygen"
|
||||
|
||||
[features]
|
||||
gl = ["gfx_device_gl"]
|
||||
discord = ["discord-rpc-sdk", "parking_lot", "lazy_static"]
|
||||
discord = ["discord-rpc-sdk", "lazy_static"]
|
||||
singleplayer = ["server", "portpicker"]
|
||||
|
||||
default = ["gl", "singleplayer", "msgbox", "heaptrack"]
|
||||
@ -34,8 +34,7 @@ vek = { version = "0.9.8", features = ["serde"] }
|
||||
|
||||
# Discord
|
||||
discord-rpc-sdk = { git = "https://github.com/Songtronix/rust-discord-rpc.git", optional = true }
|
||||
parking_lot = { version = "0.9.0", optional = true }
|
||||
lazy_static = { version = "1.3.0", optional = true }
|
||||
lazy_static = { version = "1.4.0", optional = true }
|
||||
|
||||
# Singleplayer
|
||||
server = { package = "veloren-server", path = "../server", optional = true }
|
||||
|
@ -1,7 +1,8 @@
|
||||
use crate::DISCORD_INSTANCE;
|
||||
use crossbeam::channel::{unbounded, Receiver, Sender};
|
||||
use crossbeam::channel::{unbounded, Sender};
|
||||
use discord_rpc_sdk::{DiscordUser, EventHandlers, RichPresence, RPC};
|
||||
use parking_lot::Mutex;
|
||||
//use parking_lot::Mutex;
|
||||
use std::sync::Mutex;
|
||||
use std::thread;
|
||||
use std::thread::JoinHandle;
|
||||
use std::time::SystemTime;
|
||||
|
@ -10,7 +10,7 @@ extern crate lazy_static;
|
||||
pub mod discord;
|
||||
|
||||
#[cfg(feature = "discord")]
|
||||
use parking_lot::Mutex;
|
||||
use std::sync::Mutex;
|
||||
|
||||
#[macro_use]
|
||||
pub mod ui;
|
||||
@ -202,6 +202,17 @@ fn main() {
|
||||
default_hook(panic_info);
|
||||
}));
|
||||
|
||||
// Initialise Discord
|
||||
#[cfg(feature = "discord")]
|
||||
{
|
||||
use discord::DiscordUpdate;
|
||||
discord::send_all(vec![
|
||||
DiscordUpdate::Details("Menu".into()),
|
||||
DiscordUpdate::State("Idling".into()),
|
||||
DiscordUpdate::LargeImg("bg_main".into()),
|
||||
]);
|
||||
}
|
||||
|
||||
// Set up the initial play state.
|
||||
let mut states: Vec<Box<dyn PlayState>> = vec![Box::new(MainMenuState::new(&mut global_state))];
|
||||
states
|
||||
|
Loading…
Reference in New Issue
Block a user