1
1
Fork 0
mirror of https://github.com/griffi-gh/hUI.git synced 2025-04-01 13:36:30 -05:00

mark as no_std`: hui-painter, hui-derive and hui-shared

This commit is contained in:
griffi-gh 2025-03-11 15:27:06 +01:00
parent 8920a42c0c
commit 1a8dd5baea
13 changed files with 28 additions and 13 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "hui-derive"
description = "Derive macros for hUI"
description = "internal crate: Provides derive macros for hUI"
repository = "https://github.com/griffi-gh/hui"
readme = "../README.md"
authors = ["griffi-gh <prasol258@gmail.com>"]

View file

@ -1,3 +1,5 @@
#![no_std]
extern crate proc_macro;
use proc_macro::TokenStream;

View file

@ -1,3 +1,7 @@
#![no_std]
#[macro_use]
extern crate alloc;
pub mod paint;
pub mod texture;
pub mod text;

View file

@ -1,3 +1,4 @@
use alloc::vec::Vec;
use glam::{Vec2, Vec4};
#[derive(Clone, Copy)]

View file

@ -1,4 +1,6 @@
use std::{hash::Hasher, ops::RangeFull};
use core::{hash::Hasher, ops::RangeFull};
use alloc::{boxed::Box, vec::Vec};
use hui_shared::rect::Rect;
use crate::PainterInstance;
use super::PaintCommand;

View file

@ -1,4 +1,4 @@
use std::{hash::Hasher, num::NonZeroU16};
use core::{hash::Hasher, num::NonZeroU16};
use glam::{vec2, Vec2};
use hui_shared::{color, rect::{Corners, FillColor, Rect}};
use crate::{
@ -7,7 +7,7 @@ use crate::{
command::PaintCommand,
},
texture::TextureHandle,
util::{hash_vec2, hash_vec3, hash_vec4},
util::{hash_vec2, hash_vec4},
PainterInstance,
};
@ -224,7 +224,7 @@ impl PaintCommand for PaintRectangle {
for i in 0..point_count as u32 {
let frac = i as f32 / (point_count - 1) as f32;
let angle = frac * std::f32::consts::PI * 0.5;
let angle = frac * core::f32::consts::PI * 0.5;
let x = angle.sin();
let y = angle.cos();
into.vertices.extend([

View file

@ -1,4 +1,5 @@
use std::{borrow::Cow, hash::{Hash, Hasher}};
use core::hash::{Hash, Hasher};
use alloc::{borrow::Cow, vec::Vec};
use fontdue::layout::{CoordinateSystem, Layout};
use glam::{vec2, Vec4};
use hui_shared::rect::Rect;

View file

@ -1,5 +1,4 @@
use std::hash::Hasher;
use core::hash::Hasher;
use glam::vec2;
use hui_shared::rect::Rect;

View file

@ -1,3 +1,4 @@
use alloc::vec::Vec;
use glam::{ivec2, uvec2, vec2, UVec2, Vec2};
use hui_shared::rect::Corners;
use rect_packer::DensePacker;

View file

@ -1,4 +1,4 @@
use std::hash::Hasher;
use core::hash::Hasher;
#[inline]
pub(crate) fn hash_vec2(hasher: &mut impl Hasher, vec: glam::Vec2) {

View file

@ -1,2 +1,4 @@
#![no_std]
pub mod rect;
pub mod color;

View file

@ -112,7 +112,7 @@ impl<T> From<(T, T, T, T)> for Corners<T> {
impl<T> IntoIterator for Corners<T> {
type Item = T;
type IntoIter = std::array::IntoIter<Self::Item, 4>;
type IntoIter = core::array::IntoIter<Self::Item, 4>;
fn into_iter(self) -> Self::IntoIter {
self.to_array().into_iter()
}
@ -120,7 +120,7 @@ impl<T> IntoIterator for Corners<T> {
impl<'a, T> IntoIterator for &'a Corners<T> {
type Item = &'a T;
type IntoIter = std::array::IntoIter<Self::Item, 4>;
type IntoIter = core::array::IntoIter<Self::Item, 4>;
fn into_iter(self) -> Self::IntoIter {
self.as_array().into_iter()
@ -129,7 +129,7 @@ impl<'a, T> IntoIterator for &'a Corners<T> {
impl<'a, T> IntoIterator for &'a mut Corners<T> {
type Item = &'a mut T;
type IntoIter = std::array::IntoIter<Self::Item, 4>;
type IntoIter = core::array::IntoIter<Self::Item, 4>;
fn into_iter(self) -> Self::IntoIter {
self.as_array_mut().into_iter()

View file

@ -1,3 +1,4 @@
// #![no_std]
#![doc(html_logo_url = "https://raw.githubusercontent.com/griffi-gh/hui/master/.assets/hui.svg")]
//!
//! Simple UI library for games and other interactive applications
@ -7,10 +8,12 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// #![deny(unsafe_code)]
#![forbid(unsafe_op_in_unsafe_fn)]
#![allow(unused_parens)]
// #[macro_use]
// extern crate alloc;
pub use hui_shared::*;
pub use hui_painter as painter;