copy and paste o.O
Blitz3D Forums/Blitz3D Programming/copy and paste o.O
| ||
Hi ya, Does anyone know how to make a game with copy and paste ability? |
| ||
I know that *you* know what's going through your mind but try to bear in mind that the rest of the world doesn't. Copy and paste =what=? Images? Text? From where? To where? To what end? |
| ||
Heres a little function I just came up with just take the input file and tell it where you want to output and it will do it. Make sure that the file extensions are the same.Function CopyPaste(copyf$,pastef$) Local c = OpenFile(copyf$) Local p = WriteFile(pastef$) Repeat Local byte = ReadByte(c) WriteByte(p,byte) Until Eof(c) End Function |
| ||
I mean literal. ctrl + c and ctrl + v copy and paste off of the clipboard ;) does anybody know a code that can do this? |
| ||
There's text-cliboard code in the code archives, using a userlib. Not sure if there is also a version somewhere that is able to copy/paste pictures. If you want to copy and paste things that are inside your game, then you don't have to use the windows clipboard. Simply catch the keypresses and do some actions, eg: ... if ctrl-c clipboard_entity=selected_entity endif if ctrl-v cloned_entity=CopyEntity(clipboard_entity) positionentity cloned_entity, playerx,playery,playerz endif ... (note: this is only pseudo code) |
| ||
I wanted to copy and paste into other windows and stuff |
| ||
I think you don't know what you want because you are not specific yet :( |
| ||
It sounds like you want an application that can copy and paste into applications? If so, what wrong with copy and paste built into windows? OR, do you want to copy and paste text produced by blitz into other apps? |
| ||
I mean onto the clipboard! You know the built in copy and paste. |
| ||
I think he wants to copy from within his blitz3D game, into any other windows application. Let's assume Text for now. The code to do so was posted in the code archives. |
| ||
Download and install the user32.decls from codearchives and stick it in your c:/P.F./blitz3d/userlibs folder. Then add these lines at the end: api_SetClipboardtext%(cb_TEXT%,txt$): "SetClipboardData" api_GetClipboardText$ (cb_TEXT%): "GetClipboardData" Then use these functions to access the clipboard (works for text only of course): Function WriteClipboardText(txt$) Local cb_TEXT=1 If txt$="" Then Return If api_OpenClipboard(0) api_EmptyClipboard() api_SetClipboardtext%(cb_TEXT,txt$) api_CloseClipboard() EndIf End Function ;----------------------------------- Function ReadClipboardText$() Local cb_TEXT=1 Local txt$="" If api_OpenClipboard(0) If api_IsClipboardFormatAvailable(cb_TEXT) txt$=api_GetClipboardtext$ (cb_TEXT) EndIf api_CloseClipboard EndIf Return txt$ End Function This should work, if not email me and ill send you my modded user32 which does work. |