sdf
This commit is contained in:
parent
ec6456b50b
commit
c0a211e073
41
src/main.zig
41
src/main.zig
@ -1,6 +1,21 @@
|
||||
const std = @import("std");
|
||||
const rl = @import("raylib");
|
||||
const rg = @import("raygui");
|
||||
const pr = @import("primitives.zig");
|
||||
|
||||
const Particle = struct{
|
||||
const Self = @This();
|
||||
position : pr.Vec = .{.a = .{.x=0,.y=0,.z=0}},
|
||||
velocity : pr.Vec = .{.a = .{.x=0,.y=0,.z=0}},
|
||||
acceleration : pr.Vec = .{.a = .{.x=0,.y=0,.z=0}},
|
||||
pub fn new(self:Self)void{
|
||||
_ = self;
|
||||
}
|
||||
pub fn update(self:Self)void{
|
||||
self.velocity = self.velocity + self.acceleration;
|
||||
self.position = self.position + self.velocity;
|
||||
}
|
||||
};
|
||||
|
||||
pub fn main() anyerror!void {
|
||||
// Initialization
|
||||
@ -10,25 +25,26 @@ pub fn main() anyerror!void {
|
||||
const rect2 = rl.Rectangle{ .x = @as(f32, @floatFromInt(10)), .y = @as(f32, @floatFromInt(10)), .width = @as(f32, @floatFromInt(300)), .height = @as(f32, @floatFromInt(100)) };
|
||||
var msg_res : i32=-1;
|
||||
var state : i32=-1;
|
||||
|
||||
const p1 = Particle{.velocity = .{.a = .{.x = 1,.y = 1}}};
|
||||
|
||||
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
|
||||
defer rl.closeWindow(); // Close window and OpenGL context
|
||||
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!rl.windowShouldClose()) { // Detect window close button or ESC key
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
defer rl.endDrawing();
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
rl.clearBackground(rl.getColor(rg.guiGetStyle(rl.DEFAULT,rl.BACKGROUND_COLOR)));
|
||||
rl.clearBackground(rl.Color{.r=181,
|
||||
.g =177,
|
||||
.b =154,
|
||||
.a = 255,
|
||||
});
|
||||
|
||||
if(state != 0){
|
||||
msg_res = rg.guiMessageBox(rect2, "Title", "question?", "Nice;Cool;dsf;asd");
|
||||
msg_res = rg.guiMessageBox(rect2, "Title", "question?", "Nice;Cool");
|
||||
if(msg_res > -1){
|
||||
state = msg_res;
|
||||
}
|
||||
@ -43,11 +59,10 @@ pub fn main() anyerror!void {
|
||||
else =>{},
|
||||
}
|
||||
}
|
||||
p1.update();
|
||||
rl.drawCircle(p1.position.a.x,p1.position.a.y,40,rl.Color{.r=124,.g=195,.b=217,.a=100});
|
||||
|
||||
rl.beginDrawing();
|
||||
defer rl.endDrawing();
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user