copy and paste o.O

Blitz3D Forums/Blitz3D Programming/copy and paste o.O

blade007(Posted 2008) [#1]
Hi ya, Does anyone know how to make a game with copy and paste ability?


Gabriel(Posted 2008) [#2]
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?


Whats My Face(Posted 2008) [#3]
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 



blade007(Posted 2008) [#4]
I mean literal. ctrl + c and ctrl + v copy and paste off of the clipboard ;) does anybody know a code that can do this?


jfk EO-11110(Posted 2008) [#5]
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)


blade007(Posted 2008) [#6]
I wanted to copy and paste into other windows and stuff


Moraldi(Posted 2008) [#7]
I think you don't know what you want because you are not specific yet :(


Ross C(Posted 2008) [#8]
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?


blade007(Posted 2008) [#9]
I mean onto the clipboard! You know the built in copy and paste.


Damien Sturdy(Posted 2008) [#10]
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.


D4NM4N(Posted 2008) [#11]
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.