import React, { Fragment } from "react";
import useLoader from "~game/lib/Loader";
import InGameSpaceBG from "./backgrounds/InGameSpaceBG";

// Resources, this will make TS go crazy!

//@ts-expect-error Image resource
import NoiseSpaceFine from "~/../assets/images/noise/space_fine.png";
//@ts-expect-error Image resource
import NoiseSpaceSparse from "~/../assets/images/noise/space_sparse.png";

export default function Game() {
  const { loaded, resources } = useLoader({
    bg_fine: NoiseSpaceFine,
    bg_sparse: NoiseSpaceSparse,
  });

  if (!loaded) {
    return <Fragment></Fragment>;
  }

  return (
    <Fragment>
      <InGameSpaceBG
        textures={{
          noise_fine: resources.bg_fine,
          noise_sparse: resources.bg_sparse,
        }}
      />
    </Fragment>
  );
}
