Add files via upload
This commit is contained in:
parent
2830304b02
commit
7a94b86b08
3 changed files with 3934 additions and 0 deletions
3837
Cargo.lock
generated
Normal file
3837
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
17
Cargo.toml
Normal file
17
Cargo.toml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
[package]
|
||||||
|
name = "startdays"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
text_io = "0.1.12"
|
||||||
|
eframe = { version = "0.29.1",features = [
|
||||||
|
"default",
|
||||||
|
"__screenshot", # __screenshot is so we can dump a screenshot using EFRAME_SCREENSHOT_TO
|
||||||
|
] }
|
||||||
|
rand = "0.8"
|
||||||
|
|
||||||
|
|
80
src/main.rs
Normal file
80
src/main.rs
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
use eframe::egui;
|
||||||
|
//use rand::Rng;
|
||||||
|
use std::{thread, time::Duration};
|
||||||
|
|
||||||
|
fn main() -> Result<(), eframe::Error> {
|
||||||
|
let options = eframe::NativeOptions::default();
|
||||||
|
eframe::run_native(
|
||||||
|
"Clicker Game Thingy",
|
||||||
|
options,
|
||||||
|
Box::new(|_cc| Ok(Box::new(MyApp::default()))),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MyApp {
|
||||||
|
score: i32,
|
||||||
|
x: i32,
|
||||||
|
upgd_cost: i32,
|
||||||
|
proc: i32,
|
||||||
|
constt: i32,
|
||||||
|
// rand_number: i32
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for MyApp {
|
||||||
|
fn default() -> Self {
|
||||||
|
//let mut rng = rand::thread_rng();
|
||||||
|
//let rand_number = rng.gen_range(1..=50);
|
||||||
|
Self { score: 0, x: 1, upgd_cost: 10, proc: 0, constt: 0}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl eframe::App for MyApp {
|
||||||
|
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||||
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
|
// Clone the style from the Arc and modify it
|
||||||
|
let mut style = (*ctx.style()).clone();
|
||||||
|
style.text_styles.insert(
|
||||||
|
egui::TextStyle::Button,
|
||||||
|
egui::FontId::proportional(24.0),
|
||||||
|
);
|
||||||
|
ctx.set_style(style);
|
||||||
|
|
||||||
|
// Display the score
|
||||||
|
ui.heading(format!("Score: {}", self.score));
|
||||||
|
ui.heading(format!("Upgrade cost: {}", self.upgd_cost));
|
||||||
|
ui.heading(format!("Autoclicker cost: {}", self.upgd_cost));
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
if ui.button("Click").clicked() {
|
||||||
|
self.score += self.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ui.button("Upgrade").clicked() {
|
||||||
|
if self.score >= self.upgd_cost {
|
||||||
|
self.score = self.score - self.upgd_cost;
|
||||||
|
self.x = self.x + 1;
|
||||||
|
self.proc = self.score * 40/100 + self.upgd_cost * 10/100;
|
||||||
|
self.upgd_cost = self.upgd_cost + self.proc;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ui.button("Autoclick").clicked() {
|
||||||
|
if self.score >= self.upgd_cost {
|
||||||
|
while self.constt == self.constt {
|
||||||
|
thread::sleep(Duration::from_millis(4000));
|
||||||
|
self.score = self.score + self.x
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue