Compare commits

...

No commits in common. "e3f7ffa5e17b3109722114d1bde3cdd99bd75362" and "603dc124dd7872ac62dffc08470bea1bd51cf9d1" have entirely different histories.

20 changed files with 94 additions and 267 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
libraylib.a
/target

6
.gitmodules vendored
View File

@ -1,6 +0,0 @@
[submodule "3rdparty/raylib"]
path = 3rdparty/raylib
url = https://github.com/raysan5/raylib
[submodule "3rdparty/raygui"]
path = 3rdparty/raygui
url = https://github.com/raysan5/raygui.git

1
3rdparty/raygui vendored

@ -1 +0,0 @@
Subproject commit 865bb293764073c01e74314ef647464f1f10fd96

1
3rdparty/raylib vendored

@ -1 +0,0 @@
Subproject commit ca12ef48e9e9f4eae03b1ca43ec3eb0a78d63dd3

7
Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "doggo"
version = "0.1.0"

8
Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "doggo"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1,49 +0,0 @@
const std = @import("std");
const raylib = @import("./3rdparty/raylib/src/build.zig");
pub fn build(b: *std.build.Builder) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("doggo", "src/main.zig");
exe.setTarget(target);
const ray = raylib.addRaylib(b, exe.target);
exe.linkLibrary(ray);
exe.addIncludeDir("3rdparty/raylib/src");
exe.addIncludeDir("3rdparty/raygui/src");
exe.addIncludeDir("3rdparty/raygui/examples");
const raylib_flags = &[_][]const u8{
"-std=gnu99",
"-DPLATFORM_DESKTOP",
"-DGL_SILENCE_DEPRECATION=199309L",
"-fno-sanitize=undefined",
};
exe.addCSourceFile("src/raylib.c", raylib_flags);
exe.setBuildMode(mode);
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const exe_tests = b.addTest("src/main.zig");
exe_tests.setTarget(target);
exe_tests.setBuildMode(mode);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&exe_tests.step);
}

View File

@ -1,23 +1,63 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1712211755,
"narHash": "sha256-KIJA4OvXFDXEeu7wstFDCxqZEfjaPQIowpzNww48TUw=",
"owner": "nix-community",
"repo": "fenix",
"rev": "39763c6e23a8423af316b85a74bad0cc5bc88d86",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1651369430,
"narHash": "sha256-d86uUm0s11exU9zLo2K1AwtJQJDKubFpoF0Iw767uT4=",
"lastModified": 1712163089,
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b283b64580d1872333a99af2b4cef91bb84580cf",
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"fenix": "fenix",
"nixpkgs": "nixpkgs"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1712156296,
"narHash": "sha256-St7ZQrkrr5lmQX9wC1ZJAFxL8W7alswnyZk9d1se3Us=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "8e581ac348e223488622f4d3003cb2bd412bf27e",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
}
},
"root": "root",

View File

@ -1,41 +1,32 @@
{
description = "Doggo flake";
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
outputs = { self, fenix, nixpkgs }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
# godot-alpha = (with pkgs; stdenv.mkDerivation {
# pname = "godot-alpha";
# version = "4.0.0-a8";
# src = fetchzip {
# url = "https://downloads.tuxfamily.org/godotengine/4.0/alpha8/Godot_v4.0-alpha8_linux.64.zip";
# hash = "sha512-qkUpt1reFgVDt5u9zLHYLoJAzC0D/YdtNpQhWLarpTW0e+Vzlqy7kna2plIeddybNsn+tS+QqTmYJExA7aT3zw==";
# };
# installPhase = ''
# mkdir -p $out/bin
# mv Godot_v4.0-alpha8_linux.64 $out/bin/godot-v4-alpha
# '';
# });
in {
devShell.x86_64-linux = with pkgs;
mkShell {
buildInputs = [
just
# zig
# godot
# godot-alpha
#
# xorg.libX11
# xorg.libXcursor
# xorg.libXi
# xorg.libXext
# xorg.libXrandr
# xorg.libXinerama
# libGL
# libGLU
];
};
mkShell {
nativeBuildInputs = [
just
(fenix.packages.x86_64-linux.fromToolchainFile {
dir = ./.;
sha256 = "sha256-3St/9/UKo/6lz2Kfq2VmlzHyufduALpiIKaaKX4Pq0g=";
})
];
buildInputs = [
];
};
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt;
};
}

View File

@ -1,26 +0,0 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
$HTTPRequest.connect("request_completed", self._on_request_completed)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var bodySize = $HTTPRequest.get_body_size()
var downloadedBytes = $HTTPRequest.get_downloaded_bytes()
var percent = downloadedBytes * 100 / bodySize
$Label.text = "Progress: %d %%" % percent
pass
func download_cpp_dap():
var url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
$HTTPRequest.download_file = "user://lldb.tar.xz"
$HTTPRequest.request(url)
func _on_request_completed(result, response_code, headers, body):
# TODO: decompress archive
# OS.execute("")
pass

View File

@ -1,27 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://cirquj62osi4v"]
[ext_resource type="Script" path="res://Main.gd" id="1_6lnje"]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( "1_6lnje" )
[node name="Button" type="Button" parent="."]
offset_left = 148.0
offset_top = 70.0
offset_right = 296.0
offset_bottom = 162.0
text = "Download C++ DAP (lldb)"
[node name="HTTPRequest" type="HTTPRequest" parent="."]
use_threads = true
[node name="Label" type="Label" parent="."]
offset_left = 359.0
offset_top = 90.0
offset_right = 598.0
offset_bottom = 136.0
text = "Progress: 0%"
[connection signal="pressed" from="Button" to="." method="download_cpp_dap"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dda5wstjh822x"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -1,16 +0,0 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="Doggo"
run/main_scene="res://Main.tscn"
config/icon="res://icon.png"
config/features=PackedStringArray("4.0", "Vulkan Clustered")

View File

@ -1,21 +1,7 @@
godot_project := "./godot-impl/project.godot"
godot_url := "https://downloads.tuxfamily.org/godotengine/4.0/alpha8/Godot_v4.0-alpha8_linux.64.zip"
godot_exe := "Godot_v4.0-alpha8_linux.64"
godot_exe_dir := "~/bin"
godot_path := godot_exe_dir + "/" + godot_exe
alias b := build
build:
cargo build
setup:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -e {{godot_path}} ]; then
curl {{godot_url}} -O
unzip Godot*.zip
mv {{godot_exe}} {{godot_exe_dir}}
rm Godot*.zip
fi
#run:
# nixGL zig build run
edit: setup
{{godot_exe}} {{godot_project}}
alias r := run
run:
cargo run

3
rust-toolchain.toml Normal file
View File

@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
profile = "default"

3
src/main.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

View File

@ -1,40 +0,0 @@
const std = @import("std");
const r = @import("raylib.zig");
pub fn main() anyerror!void {
r.InitWindow(800, 450, "doggo");
defer r.CloseWindow();
// var selected_filename: [512]u8 = undefined;
var file_dialog_state = r.InitGuiFileDialog(420, 310, r.GetWorkingDirectory(), false);
while (!r.WindowShouldClose()) {
// Update
if (file_dialog_state.SelectFilePressed) {
std.log.info("{s} / {s}", .{ file_dialog_state.dirPathText, file_dialog_state.fileNameText });
}
// Draw
r.BeginDrawing();
defer r.EndDrawing();
r.ClearBackground(r.RAYWHITE);
r.DrawText("Congrats! You created your first window!", 190, 200, 20, r.LIGHTGRAY);
if (file_dialog_state.fileDialogActive) {
r.GuiLock();
}
if (r.GuiButton(r.Rectangle{ .x = 190, .y = 250, .width = 150, .height = 30 }, "Button")) {
std.log.info("Button pressed", .{});
file_dialog_state.fileDialogActive = true;
}
r.GuiUnlock();
r.GuiFileDialog(&file_dialog_state);
}
}
test "basic test" {
try std.testing.expectEqual(10, 3 + 7);
}

View File

@ -1,6 +0,0 @@
#define RAYGUI_IMPLEMENTATION
#include <raygui.h>
#undef RAYGUI_IMPLEMENTATION // Avoid including raygui implementation again
#define GUI_FILE_DIALOG_IMPLEMENTATION
#include <custom_file_dialog/gui_file_dialog.h>

View File

@ -1,5 +0,0 @@
pub usingnamespace @cImport({
@cInclude("raylib.h");
@cInclude("raygui.h");
@cInclude("custom_file_dialog/gui_file_dialog.h");
});