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
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
add a comment |
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
add a comment |
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
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
haskell gloss
asked 2 days ago
LorenzoLorenzo
1,19417
1,19417
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can use the file-embed package, which uses Template Haskell to embed files.
https://www.stackage.org/package/file-embed
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 usebitmapOfByteString
– Lorenzo
2 days ago
You use something like$(embedFile "file.bmp"). You'll need to enable theTemplateHaskellpragma.
– Michael Snoyman
yesterday
add a comment |
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!
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
You can use the file-embed package, which uses Template Haskell to embed files.
https://www.stackage.org/package/file-embed
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 usebitmapOfByteString
– Lorenzo
2 days ago
You use something like$(embedFile "file.bmp"). You'll need to enable theTemplateHaskellpragma.
– Michael Snoyman
yesterday
add a comment |
You can use the file-embed package, which uses Template Haskell to embed files.
https://www.stackage.org/package/file-embed
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 usebitmapOfByteString
– Lorenzo
2 days ago
You use something like$(embedFile "file.bmp"). You'll need to enable theTemplateHaskellpragma.
– Michael Snoyman
yesterday
add a comment |
You can use the file-embed package, which uses Template Haskell to embed files.
https://www.stackage.org/package/file-embed
You can use the file-embed package, which uses Template Haskell to embed files.
https://www.stackage.org/package/file-embed
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 usebitmapOfByteString
– Lorenzo
2 days ago
You use something like$(embedFile "file.bmp"). You'll need to enable theTemplateHaskellpragma.
– Michael Snoyman
yesterday
add a comment |
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 usebitmapOfByteString
– Lorenzo
2 days ago
You use something like$(embedFile "file.bmp"). You'll need to enable theTemplateHaskellpragma.
– 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
add a comment |
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!
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
add a comment |
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!
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
add a comment |
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!
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!
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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