Silly question for BMax and Wine

BlitzMax Forums/BlitzMax Programming/Silly question for BMax and Wine

Tricky(Posted 2013) [#1]
I already wrote in the bug reports that a project of mine was in a standstill because I have some issues in Linux that are really unacceptable (keys and mouse buttons don't register well in Linux).
My primary system is MacOS, but as my iMac is broken at this moment, both MacOS *and* Windows were a bit beyond my reach. (and my cashflow is bad at this moment, so I cannot buy any new machine now of any kind).

Now I have a Linux box I use as an emergency system and I tried my game in Wine (compiled in Windows before my iMac broke) and it works. Well, some tiny issues as the background music stops where it shouldn't, and the game is a bit slower, but it works good enough to test things, and as my current work is sorting out game scripts and graphics, I can at least work a little further for the next couple of months.

Of course, as my main engine written in BMax isn't quite finished yet, I may need to modify it a bit more as time comes by requiring me to re-compile it. Now I think there was a topic about this before, but I can't find it anywhere so that's why I ask it again, does BlitzMax itself (most notably the compiler) work well in Wine? Or do I still need to borrow a Windows PC somewhere to get the compiling done.

What are your experiences on this?


GfK(Posted 2013) [#2]
Linux on its own is a complete ballache - never mind trying to get it to emulate Windows (or whatever it claims to be, if not an emulator).

Personally, I'd ditch Linux for the sack of crap that it is, and install Windows XP on whatever you're currently running Linux on.

Seriously.


Tricky(Posted 2013) [#3]
Linux never lived up to my expectations either, and there's a long way to go for Linux to be a true acceptable OS indeed.
Point is (maybe I should have pointed that out in my first post), that this Linux machine was there to do the stuff for which I need Linux, so 'ditching' it, is (too bad) not an option :(

I agree emulators (or whatever they are called, before somebody jerks up about this) aren't the ideal way to go, but if they work I am saved for now so I have more time to get the cashflow in a way I can afford fixing/replacing my iMac :)


Derron(Posted 2013) [#4]
sudo apt-get install virtualbox-4.0

then start virtualbox, create a new machine, create a new "hard disc" (an image file) with dynamical associated space.

Mount the .iso-image of your choice (eg. winxpsp3.iso - or how the image of your windows is named - downloadable legally, you have to provide the correct key...).

Now boot that virtual machine, install your windows... install blitzmax.

Create a network mapped drive (linux -> samba ->share your working directory) so at the end in windows your "z:\" is a mount to your working folder of the linux machine.
Alternatively you can use "shared folders" and other things..


Happy coding.


PS: I do not have "unrecognized keystrokes" in my linux apps.


bye
Ron


Tricky(Posted 2013) [#5]
Thanks... I was hoping I wouldn't have to take the long way through a VM, but apparently it's the safest road to travel.

PS: I do not have "unrecognized keystrokes" in my linux apps.


Odd... I do have them in ALL the apps I coded in BlitzMax. In an experimental project I made in Python (+PyGame) I don't have this issue in Linux (and in Windows it also works, so I found out when I could test things out on somebody else's machine). In my Linux builds of my BlitzMax code, however, I have to press every key around 6 times in succession before it's registered, and the WaitKey() command acts like WaitForever() if you get what I mean. (I use Mint btw).


*(Posted 2013) [#6]
I have had the opposite tbh windows sometimes drops keys not linux, I do agree though that some distros are a pain which is why I always use Ubuntu as its the one that seems to have the most support ATM.


Derron(Posted 2013) [#7]
I am on mint too ("15" atm).

Special keys like "alt" or "ö" are problematic: alt is a special key for the window manager (if not unset by the user) and the umlauts are not registered by the default PolledInput.

What method do you use to check for keypresses?

I use "KeyDown" here - together with a "keyTime" or "intervall". So If I keep the "A"-Key pressed, my "IsHit"-function just returns true one time. But I have an "IsHold" function which returns True after a certain delay...like you may know it from your normal OS-text-inputs.

So in short: instead of KeyHit I use:
if not myKeyHit[key_xyz] then myKeyHit[key_xyz]=KeyDown(key_xyz)
return myKeyHit[key_xyz]

But...both (KeyHit and KeyDown) react on received KEY_DOWN/KEY_UP-events (check polledInput.bmx).

But... KeyHit(key_xyz) gets 0ed on each call - so you cannot call it 2 times per "update", keyDown keeps set until the user releases the button.

I cannot imagine it happens to you but not that much others. So i just coded a simple test app now:

Graphics 400,300

global lastKeys:string[10]
global lastKeyPos:int = 0
global inputMode:int = 0
global inputModeString:string = ""
repeat
	local char:int = 0
	local i:int = 0
	if inputMode = 0
		char = int(GetChar())
		inputModeString = "GetChar"
	elseif inputMode = 1
		For i = 0 to 255
			if KeyHit(i) then char = i
		Next
		inputModeString = "KeyHit"
	else
		For i = 0 to 255
			if KeyDown(i) then char = i
		Next
		inputModeString = "KeyDown"
	endif

	if char<>0
		lastKeys[lastKeyPos] = "input: "+char+" [time: "+Millisecs()+"]"
		lastKeyPos :+1
		if lastKeyPos = 10 then lastKeyPos = 0
	endif
	cls
	DrawText("Keypress-Demo", 0,0)
	DrawText("Press space to switch input mode. Current: "+inputModeString, 0,280)
	for i = 0 to 9
		DrawText(lastKeys[(lastKeyPos + i) mod 10], 10, 150-i*15)
	Next
	flip

	'change input mode
	if char = KEY_SPACE
		inputMode:+1
		if inputMode=3 then inputMode =0
		FlushKeys()
	endif
until KeyDown(KEY_ESCAPE)


Tested on: linux mint 15 64bit, windowsxp virtual, windowsxp real. Without flaws.

Does one of the modes not work for you (at the end they are just connected to the ondown and onup events... but maybe you just call some functions multiple times).

bye
Ron


Tricky(Posted 2013) [#8]
I'll try your demo out when I have more time.... Anyway, thanks for thinking with me ;)


Tricky(Posted 2013) [#9]
First result:
Building LinKeyTest
Compiling:LinKeyTest.bmx
flat assembler version 1.68 (32768 kilobytes memory)
3 passes, 4599 bytes.
Linking:LinKeyTest
/usr/bin/ld: /home/rachel/Apps/BlitzMax/mod/pub.mod/openal.mod/openal.release.linux.x86.a(openal.c.release.linux.x86.o): undefined reference to symbol 'dlopen@@...'
/usr/bin/ld: note: 'dlopen@@...' is defined in DSO /lib/i386-linux-gnu/libdl.so.2 so try adding it to the linker command line
/lib/i386-linux-gnu/libdl.so.2: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
Build Error: Failed to link /media/rachel/Irravonia/Projects/Test/Linux Keyboard Test/LinKeyTest
Process complete


Right..... That's marvellous....


Okay, I added "Framework BRL.GLMax2D" and that problem was solved. Anyway, in this demo everything works perfectly. I don't know why, all I can think of is that this demo is less system demanding than a full game (as in my big project, entering the player's name works perfectly, but making a choice in the main menu does not).


Basically I just use KeyDown and KeyHit to do all this (and MouseHit and MouseDown, where I got the same trouble). My game Scyndi's Forest Quest (which can be downloaded here. (best to leave the .deb file be. It doesn't work so well, the zip file for Linux is okay, and the source is also there) suffered from this issue big way. What I also saw, is the mouse pointer, in changes shape depending if the mouse button is being pressed or not (I mean after you are past the language selection which comes first). When I press the mousebutton it sometimes does not respond, and when I release the mouse button I often see the mouse pointer look like the button is still pressed.

When you want to try to compile the source yourself, you need first of all Brucey's Volumes module, and all other stuff that game uses is to be found here: http://tinyurl.com/trickymods

(I had to note that, as the docs inside the game source itself, may be outdated).