added circle coordinate function

This commit is contained in:
LinlyBoi
2023-05-06 11:25:24 +03:00
parent b61e95aa19
commit 06c1131267

View File

@@ -1,6 +1,7 @@
use raylib::prelude::*;
const NROW: i32 = 6;
const NCOL: i32 = 7;
fn main() {
let (mut rl, thread) = raylib::init().size(640, 480).title("Hello, World").build();
@@ -39,7 +40,7 @@ fn main() {
let pressed_key = rl.get_key_pressed();
let mut d = rl.begin_drawing(&thread);
d.clear_background(Color::WHITE);
d.draw_texture(&circle_texture, 7, 9, Color::VIOLET);
d.draw_texture(&circle_texture, 7, 350, Color::VIOLET);
d.draw_texture(&board_texture, 0, 0, Color::VIOLET);
if let Some(pressed_key) = pressed_key {
// Certain keyboards may have keys raylib does not expect. Uncomment this line if so.
@@ -48,3 +49,25 @@ fn main() {
}
}
}
const STARTX: i32 = 7;
const STARTY: i32 = 9;
const WX: i32 = 13;
const WY: i32 = 15;
const CIRCLEWIDTH: i32 = 55;
fn get_circle_coords(row: i32, column: i32) -> (i32, i32) {
let mut returned: (i32, i32) = (STARTX, STARTY);
match row {
1 => {}
_ => {
returned.0 = STARTX + (CIRCLEWIDTH * (row - 1)) + (WX * (row - 1));
}
};
match column {
1 => {}
_ => {
returned.0 = STARTY + (CIRCLEWIDTH * (column - 1)) + (WY * (column - 1));
}
};
returned
}