![]() |
|
Writing to/getting clipboard data |
Felix-The-Ghost
Member #9,729
April 2008
![]() |
Hello, right now I was wanting to export a bitmap to the system clipboard, although being able to fetch this would be nice as well. |
Don Freeman
Member #5,110
October 2004
![]() |
You would want to make that part of your build system. If they compile it on Linux...then the Linux code would be used, and so on for the other OS versions. Just look at how Allegro does this.::) -- |
Felix-The-Ghost
Member #9,729
April 2008
![]() |
torhu
Member #2,727
September 2002
![]() |
MSDN docs for the clipboard are here: I've never used that part of the api myself, though. Allegro has a function to convert an allegro bitmap into a Windows bitmap, that you can pass to SetClipboardData(): Good luck |
Felix-The-Ghost
Member #9,729
April 2008
![]() |
torhu
Member #2,727
September 2002
![]() |
Cross-platform GUI libs often have clipboard functionality. I guess you could borrow some code from one of them. Or use one of them directly. Otherwise, you'll just have to implement it yourself on each platform. |
Thomas Harte
Member #33
April 2000
![]() |
There is a cross-platform clipboard access add-on for SDL, probably you could adapt what you need from that. Otherwise, I can offer this code, which should be trivial to adapt, that I use myself for copying an SDL surface to the OS X clipboard:
(edit: that's Objective-C++, put it in a file with a name ending in .mm, put the standard C or C++ function definition into an ordinary header file, include the header file from ordinary C or C++ code and call the function as you would any other; implement the Windows equivalent in a .c or .cpp file and call it through the same header — then just pick which file to include in your project according to your platform). And for copying to the Windows clipboard:
[My site] [Tetrominoes] |
Elias
Member #358
May 2000
|
Hm, someone want to make a clipboard addon for A5? -- |
Don Freeman
Member #5,110
October 2004
![]() |
I would, but I don't know how to get the clipboard info in X or on a Mac OS... Even if I did, I would not be able to provide any Mac code....I don't own one to test on.::) -- |
Evert
Member #794
November 2000
![]() |
Quote:
someone want to make a clipboard addon for A5? My thoughts exactly, after reading the first post. Quote: I would, but I don't know how to get the clipboard info in X or on a Mac OS... Even if I did, I would not be able to provide any Mac code....I don't own one to test on.
That's ok, I'll do the Mac port. Elias can do the X11/GTK port. That's how it went for the file picker addon too. |
Don Freeman
Member #5,110
October 2004
![]() |
Quote:
That's ok, I'll do the Mac port. Elias can do the X11/GTK port. That's how it went for the file picker addon too. Ok...I'll try to get some work done on it tonight then. I've been battling another stupid chest cold. It really sucks when you already have breathing problems...like asthma.:-/ I'll just post something here, or in my own thread...I don't have write access to the Allegro SVN. I really need to check about that though...I've not tried to get it yet.:'( How do I go about getting write access anyway?!??? -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Quote: My thoughts exactly, after reading the first post. I kept needing to refrain from posting a "Allegro 5 needs a clipboard addon" message The main issue with making such a beast is that every platform does it a little bit differently. Clipboard/D&D support in an app with a nice cross platform gui isn't exactly a cake walk.. edit: Quote: How do I go about getting write access anyway?!??? Make some patches, do some work, and people will give you write access when they think you are ready -- |
Don Freeman
Member #5,110
October 2004
![]() |
Quote:
Make some patches, do some work, and people will give you write access when they think you are ready OK...I Got ya.8-) -- |
BAF
Member #2,981
December 2002
![]() |
Allegro 5 is a game library.... why the hell does a game need to use the clipboard? |
Thomas Harte
Member #33
April 2000
![]() |
A game probably doesn't, but it might. Isn't that why the add-on system was invented? [My site] [Tetrominoes] |
Don Freeman
Member #5,110
October 2004
![]() |
I use Allegro for other stuff as well. Games need level editors and such. It would be nice to have a uniform approach. You could even have the editor built into the game. Another nice feature...it's multiplatform, if designed correctly. -- |
Elias
Member #358
May 2000
|
Almost all network games need copy&paste for the in-game chat. Look for example at Wesnoth - it would be really annoying if you could not copy&paste there. -- |
LennyLen
Member #5,313
December 2004
![]() |
Quote: I use Allegro for other stuff as well.
Only one of my Allegro projects has been a game. Most of what I've used it for has been command line image manipulation tools and graphing utilities.
|
Don Freeman
Member #5,110
October 2004
![]() |
And once again...I will bring up the network addon for a5.::) Anyone interested? On the clipboard issue: Here is what I am thinking of the function protos: ALLEGRO_CLIPBOARD_DATA * al_get_clipboard_data( ALLEGRO_DISPLAY *display ); bool al_set_clipboard_data( ALLEGRO_CLIPBOARD_DATA *data ); and then probably have conversion routines to convert from a ALLEGRO_CLIPBOARD_DATA struct to the various stuff, like an ALLEGRO_BITMAP or ALLEGRO_SAMPLE...probably add the ability for user defined types as well. Hey, has anyone seen SpellCaster in a while?! -- |
Alianix
Member #10,518
December 2008
![]() |
There are times when we should draw the line in the sand, and this is such an occasion. "Say no to copy clip board addon for AL5 !" I beg you...;D
|
Timorg
Member #2,028
March 2002
|
There is a line in the sand, but if someone is willing to develop and support an addon who are we to stop them. From the point of view of getting it included into allegro, that I agree with, I really can't see that happening. ____________________________________________________________________________________________ |
|