Include sprites into binary — Gloss library2019 Community Moderator ElectionIs functional GUI programming possible?What are the best Haskell libraries to operationalize a program?How to avoid operating in the IO monad for this whole program?What combination of libraries to provide 2-D graphics, optionally in webapp? (Haskell)Haskell gloss: render Picture to BitmapSVG backend for gloss?Specify list type for inputProfiling options not working with glossImporting files from different folders with Haskell source codeMouse handler in Haskell Gloss on Mac

Inorganic chemistry handbook with reaction lists

Where is the License file location for Identity Server in Sitecore 9.1?

Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?

std::string vs const std::string& vs std::string_view

What is better: yes / no radio, or simple checkbox?

Can I challenge the interviewer to give me a proper technical feedback?

How strong is the axiom of well-ordered choice?

How does learning spells work when leveling a multiclass character?

Did Amazon pay $0 in taxes last year?

Why do we call complex numbers “numbers” but we don’t consider 2-vectors numbers?

What is the oldest European royal house?

An Undercover Army

Draw this image in the TIKZ package

What can I do if someone tampers with my SSH public key?

Is the differential, dp, exact or not?

Unidentified signals on FT8 frequencies

Can Witch Sight see through Mirror Image?

Create chunks from an array

What exactly is the meaning of "fine wine"?

Is it a Cyclops number? "Nobody" knows!

Why aren't there more Gauls like Obelix?

Does an unused member variable take up memory?

Having the player face themselves after the mid-game

Why does a car's steering wheel get lighter with increasing speed



Include sprites into binary — Gloss library



2019 Community Moderator ElectionIs functional GUI programming possible?What are the best Haskell libraries to operationalize a program?How to avoid operating in the IO monad for this whole program?What combination of libraries to provide 2-D graphics, optionally in webapp? (Haskell)Haskell gloss: render Picture to BitmapSVG backend for gloss?Specify list type for inputProfiling options not working with glossImporting files from different folders with Haskell source codeMouse handler in Haskell Gloss on Mac










4















I am trying to make a flappy bird game in Haskell and I'd like to know if there's a way to "compile" the .bmp files into the binary? So I can only share the executable and don't need a folder with the sprites.



I am using gloss-1.13.0.1 and loading the bmp as



bg0Pic = unsafePerformIO . loadBMP $ "bg0.bmp"


I know unsafePerformIO is not good practice but that's not of my concern yet. Should I use a different approach so that the compiler knows I need that image or is there just no way to do that?



Can find the whole code on GitHub










share|improve this question


























    4















    I am trying to make a flappy bird game in Haskell and I'd like to know if there's a way to "compile" the .bmp files into the binary? So I can only share the executable and don't need a folder with the sprites.



    I am using gloss-1.13.0.1 and loading the bmp as



    bg0Pic = unsafePerformIO . loadBMP $ "bg0.bmp"


    I know unsafePerformIO is not good practice but that's not of my concern yet. Should I use a different approach so that the compiler knows I need that image or is there just no way to do that?



    Can find the whole code on GitHub










    share|improve this question
























      4












      4








      4


      2






      I am trying to make a flappy bird game in Haskell and I'd like to know if there's a way to "compile" the .bmp files into the binary? So I can only share the executable and don't need a folder with the sprites.



      I am using gloss-1.13.0.1 and loading the bmp as



      bg0Pic = unsafePerformIO . loadBMP $ "bg0.bmp"


      I know unsafePerformIO is not good practice but that's not of my concern yet. Should I use a different approach so that the compiler knows I need that image or is there just no way to do that?



      Can find the whole code on GitHub










      share|improve this question














      I am trying to make a flappy bird game in Haskell and I'd like to know if there's a way to "compile" the .bmp files into the binary? So I can only share the executable and don't need a folder with the sprites.



      I am using gloss-1.13.0.1 and loading the bmp as



      bg0Pic = unsafePerformIO . loadBMP $ "bg0.bmp"


      I know unsafePerformIO is not good practice but that's not of my concern yet. Should I use a different approach so that the compiler knows I need that image or is there just no way to do that?



      Can find the whole code on GitHub







      haskell gloss






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      LorenzoLorenzo

      1,19417




      1,19417






















          2 Answers
          2






          active

          oldest

          votes


















          2














          You can use the file-embed package, which uses Template Haskell to embed files.



          https://www.stackage.org/package/file-embed






          share|improve this answer























          • I can't seem to understand how to use it, and the documentation is not the best. Could you please just give an example on how I'd need to chance my code to get the bmp

            – Lorenzo
            2 days ago











          • Ok,looks like I need to convert the Q expr into a ByteString and then i can use bitmapOfByteString

            – Lorenzo
            2 days ago











          • You use something like $(embedFile "file.bmp"). You'll need to enable the TemplateHaskell pragma.

            – Michael Snoyman
            yesterday


















          3














          One approach is to use Data Files with cabal.



          The idea is that you add all data files (text, images, sprites, other binaries) you want to bundle with your application and access at runtime under the Data-Files header in your .cabal file.



          This will cause cabal to generate a Paths module for you, which you can access in whatever module needs it.



          More info can be found here!






          share|improve this answer























          • It seems like this only links the file with the binary, but it still needs to be installed with cabal. I am looking for a way to embed it in the binary so thats independent

            – Lorenzo
            2 days ago






          • 1





            Then I would recommend Snoyman's answer! ^^

            – sara
            yesterday










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026330%2finclude-sprites-into-binary-gloss-library%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          You can use the file-embed package, which uses Template Haskell to embed files.



          https://www.stackage.org/package/file-embed






          share|improve this answer























          • I can't seem to understand how to use it, and the documentation is not the best. Could you please just give an example on how I'd need to chance my code to get the bmp

            – Lorenzo
            2 days ago











          • Ok,looks like I need to convert the Q expr into a ByteString and then i can use bitmapOfByteString

            – Lorenzo
            2 days ago











          • You use something like $(embedFile "file.bmp"). You'll need to enable the TemplateHaskell pragma.

            – Michael Snoyman
            yesterday















          2














          You can use the file-embed package, which uses Template Haskell to embed files.



          https://www.stackage.org/package/file-embed






          share|improve this answer























          • I can't seem to understand how to use it, and the documentation is not the best. Could you please just give an example on how I'd need to chance my code to get the bmp

            – Lorenzo
            2 days ago











          • Ok,looks like I need to convert the Q expr into a ByteString and then i can use bitmapOfByteString

            – Lorenzo
            2 days ago











          • You use something like $(embedFile "file.bmp"). You'll need to enable the TemplateHaskell pragma.

            – Michael Snoyman
            yesterday













          2












          2








          2







          You can use the file-embed package, which uses Template Haskell to embed files.



          https://www.stackage.org/package/file-embed






          share|improve this answer













          You can use the file-embed package, which uses Template Haskell to embed files.



          https://www.stackage.org/package/file-embed







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 days ago









          Michael SnoymanMichael Snoyman

          27.9k23567




          27.9k23567












          • I can't seem to understand how to use it, and the documentation is not the best. Could you please just give an example on how I'd need to chance my code to get the bmp

            – Lorenzo
            2 days ago











          • Ok,looks like I need to convert the Q expr into a ByteString and then i can use bitmapOfByteString

            – Lorenzo
            2 days ago











          • You use something like $(embedFile "file.bmp"). You'll need to enable the TemplateHaskell pragma.

            – Michael Snoyman
            yesterday

















          • I can't seem to understand how to use it, and the documentation is not the best. Could you please just give an example on how I'd need to chance my code to get the bmp

            – Lorenzo
            2 days ago











          • Ok,looks like I need to convert the Q expr into a ByteString and then i can use bitmapOfByteString

            – Lorenzo
            2 days ago











          • You use something like $(embedFile "file.bmp"). You'll need to enable the TemplateHaskell pragma.

            – Michael Snoyman
            yesterday
















          I can't seem to understand how to use it, and the documentation is not the best. Could you please just give an example on how I'd need to chance my code to get the bmp

          – Lorenzo
          2 days ago





          I can't seem to understand how to use it, and the documentation is not the best. Could you please just give an example on how I'd need to chance my code to get the bmp

          – Lorenzo
          2 days ago













          Ok,looks like I need to convert the Q expr into a ByteString and then i can use bitmapOfByteString

          – Lorenzo
          2 days ago





          Ok,looks like I need to convert the Q expr into a ByteString and then i can use bitmapOfByteString

          – Lorenzo
          2 days ago













          You use something like $(embedFile "file.bmp"). You'll need to enable the TemplateHaskell pragma.

          – Michael Snoyman
          yesterday





          You use something like $(embedFile "file.bmp"). You'll need to enable the TemplateHaskell pragma.

          – Michael Snoyman
          yesterday













          3














          One approach is to use Data Files with cabal.



          The idea is that you add all data files (text, images, sprites, other binaries) you want to bundle with your application and access at runtime under the Data-Files header in your .cabal file.



          This will cause cabal to generate a Paths module for you, which you can access in whatever module needs it.



          More info can be found here!






          share|improve this answer























          • It seems like this only links the file with the binary, but it still needs to be installed with cabal. I am looking for a way to embed it in the binary so thats independent

            – Lorenzo
            2 days ago






          • 1





            Then I would recommend Snoyman's answer! ^^

            – sara
            yesterday















          3














          One approach is to use Data Files with cabal.



          The idea is that you add all data files (text, images, sprites, other binaries) you want to bundle with your application and access at runtime under the Data-Files header in your .cabal file.



          This will cause cabal to generate a Paths module for you, which you can access in whatever module needs it.



          More info can be found here!






          share|improve this answer























          • It seems like this only links the file with the binary, but it still needs to be installed with cabal. I am looking for a way to embed it in the binary so thats independent

            – Lorenzo
            2 days ago






          • 1





            Then I would recommend Snoyman's answer! ^^

            – sara
            yesterday













          3












          3








          3







          One approach is to use Data Files with cabal.



          The idea is that you add all data files (text, images, sprites, other binaries) you want to bundle with your application and access at runtime under the Data-Files header in your .cabal file.



          This will cause cabal to generate a Paths module for you, which you can access in whatever module needs it.



          More info can be found here!






          share|improve this answer













          One approach is to use Data Files with cabal.



          The idea is that you add all data files (text, images, sprites, other binaries) you want to bundle with your application and access at runtime under the Data-Files header in your .cabal file.



          This will cause cabal to generate a Paths module for you, which you can access in whatever module needs it.



          More info can be found here!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 days ago









          sarasara

          2,280722




          2,280722












          • It seems like this only links the file with the binary, but it still needs to be installed with cabal. I am looking for a way to embed it in the binary so thats independent

            – Lorenzo
            2 days ago






          • 1





            Then I would recommend Snoyman's answer! ^^

            – sara
            yesterday

















          • It seems like this only links the file with the binary, but it still needs to be installed with cabal. I am looking for a way to embed it in the binary so thats independent

            – Lorenzo
            2 days ago






          • 1





            Then I would recommend Snoyman's answer! ^^

            – sara
            yesterday
















          It seems like this only links the file with the binary, but it still needs to be installed with cabal. I am looking for a way to embed it in the binary so thats independent

          – Lorenzo
          2 days ago





          It seems like this only links the file with the binary, but it still needs to be installed with cabal. I am looking for a way to embed it in the binary so thats independent

          – Lorenzo
          2 days ago




          1




          1





          Then I would recommend Snoyman's answer! ^^

          – sara
          yesterday





          Then I would recommend Snoyman's answer! ^^

          – sara
          yesterday

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026330%2finclude-sprites-into-binary-gloss-library%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229