The proprietary driver doesnt support switching on the fly, so you have to configure X to use only the nvidia device. I followed that wiki page and got to the state I was in (x starts but winecfg hangs). So I used nvida-xconfig to generate an x config, but when x started it failed to detect any screens, so I looked at this and after following that everything works.
Turns out it was my x config. I have an NVIDIA Optimus laptop (intel integrated gpu and discrete nvidia gpu). It's hard to explain but the x config was correct enough to work. However, my best guess is that winecfg was trying to use a screen that didn't really exist to show the gui. Either way I fixed my x config and now everything works.
No output. The gui doesn't show at all. It's like it's stuck. Looking at strace, it's the same output as above, stuck trying to read from a pipe from itself.
If I understand you correctly you want touchX and touchY to be in camera (aka tile) coordinates. If that's the case then you do need to unproject:
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
Vector3 tileCoords = new Vector3();
camera.unproject(tileCoords.set(screenX, screenY, 0));
// tileCoords now holds the tile that was touched,
// however if you dont need the precision (ie you dont care if the touch was actually between tiles) then
// you can just cast to int:
tileCoords.set((int)tileCoords.x, (int)tileCoords.y, 0);
// rest of your code here
}
How do you figure out the value for SCREEN_TO_VIEWPORT_RATIO? Is that pixels / blocks? So in this case that would be 1 px / 10 blocks because the sprite is 1 x 1px and we are showing 10 x 10 blocks?
Maybe it would be easier to explain what I'm trying to accomplish. I want to create a "world" of tiles 20 tiles wide and 15 tiles high (one tile is 64px X 64px). I want to show as much of the world as possible that the screen will allow (ie. larger screens show more of the world, smaller screens show less) while maintaining that my tiles stay square (otherwise they dont look good at all). This is where I'm stuck, I don't know how to create the camera to accomplish this. Right now the tiles look all stretched and horrible like this
Libgdx is very complicated and daunting. It also is a little more difficult to use it for 2d games; you have to worry about a camera, a viewport, make sure the aspect ratio is correct, working with different coordinate systems (virtual vs physical) etc. It felt like XNA did most of that behind the scenes for you. Perhaps it's just me though. However, while the documentation is pretty good, it's not so easy for beginners (or at least for me) who haven't dealt with game programming before.
Right now I'm struggling with doing something simple that I've been able to do in other frameworks easily (love2d and even XNA). I feel like I need a lot of handholding with libgdx, but for xna (and even love2d) I was able to easily grasp it and create something. This is actually part of the reason I've stopped working on my game (the other being I've been extremely busy).
Some things I'm struggling with:
The whole coordinate system. I just don't get this, I'm supposed to use some arbitrary screen independent measurement. For example, I want to create a "world" that's 10 tiles wide x 20 tiles high. OK I setup my camera and now the sprites are stretched. Now I have to worry about calculating the correct aspect ratio across screen resizes.
Using the TileMapRenderer (et al) to render a simple map (not based on tmx, but just a simple tilemap [ie 2d int array]) and allow a character to move around on it while also moving the camera as he approaches the edge of the screen. I've got the map and character rendering fine, but it's difficult to translate between 3 different coordinate systems (tiles, screen, and world). Hell just doing a simple camera.translate(3, 0, 0) to move it over doesnt seem to do anything (and in what coordinate system do I give the value in)?
I'm not sure why I can't grasp what libgdx has to offer, but I've been able to achieve all of this with other frameworks easily without having to worry about different coordinate systems, aspect ratios, etc. It just seems unnecessarily complicated to me.
Apparently if you're using bumblebee (like I am), it knows how to find the correct lib32 nvidia libs without needing lib32-nvidia-libgl. From the wiki:
Do not install lib32-nvidia-libgl! Bumblebee will find the correct lib32 nvidia libs without it.
What if you have two video cards (Intel and Nvidia)?
$ sudo pacman -S lib32-nvidia-libgl
resolving dependencies...
looking for inter-conflicts...
:: lib32-nvidia-libgl and lib32-mesa-libgl are in conflict (lib32-libgl). Remove lib32-mesa-libgl? [y/N] Y
error: failed to prepare transaction (could not satisfy dependencies)
:: lib32-intel-dri: requires lib32-mesa-libgl=9.1.1
Is it generally frowned upon to use pacman -Sy foo to install packages (even when there aren't updates like this)? Would it be better to just do pacman -S foo instead?
Have a look at the dbus wiki page. Specifically the part about
gnome-session, startkde and startxfce4 will start a D-Bus session automatically if it isn't already running.
If you aren't using gnome, kde, or xfce then you can source scripts in /etc/X11/xinit/xinitrc.d in your ~/.xinitrc:
#!/bin/sh
# Source scripts in /etc/X11/xinit/xinitrc.d/
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec $your_window_manager
I don't use nautilus myself. However, are these windows shares you're trying to access? If so does smbclient work? Also this suggests you need dbus running although it is fairly old so I don't know if it's still relevant.
It's been 2 months so far of very casual programming (2-3 hours every other night). I'm not completely finished but it's getting there. Of course my game is extremely simple. This is the state of it right now:
It's starting to look like a real game now! The biggest challenge I faced was making small programming mistakes throughout the week. Typos, missing characters, etc; it's always the small things :P
I tried this the other day porting my XNA to MonoGame on Linux and it went alright. I started blogging about it but didn't finish because I came across a few issues. I was using the automatic content serialization to read in xml files for some of my content and MonoGame didn't like it.
The one thing that bothers me though is that assets have to be compiled to xnb files on Windows before using them with MonoGame. I couldn't ditch Windows altogether :(
The proprietary driver doesnt support switching on the fly, so you have to configure X to use only the nvidia device. I followed that wiki page and got to the state I was in (x starts but winecfg hangs). So I used nvida-xconfig to generate an x config, but when x started it failed to detect any screens, so I looked at this and after following that everything works.
Thanks for trying to help :)
Turns out it was my x config. I have an NVIDIA Optimus laptop (intel integrated gpu and discrete nvidia gpu). It's hard to explain but the x config was correct enough to work. However, my best guess is that winecfg was trying to use a screen that didn't really exist to show the gui. Either way I fixed my x config and now everything works.
env | grep WINEgives me nothing. Completely removed wine and things:And then same issue. winecfg just hangs trying to read from a pipe:
Eventually after a few minutes of letting winecfg sit there I get this on the terminal
No output. The gui doesn't show at all. It's like it's stuck. Looking at strace, it's the same output as above, stuck trying to read from a pipe from itself.
Same issue
This is what you should use here.
drillis a near drop-in replacement fordigIf I understand you correctly you want
touchXandtouchYto be in camera (aka tile) coordinates. If that's the case then you do need to unproject:How do you figure out the value for
SCREEN_TO_VIEWPORT_RATIO? Is that pixels / blocks? So in this case that would be 1 px / 10 blocks because the sprite is 1 x 1px and we are showing 10 x 10 blocks?Maybe it would be easier to explain what I'm trying to accomplish. I want to create a "world" of tiles 20 tiles wide and 15 tiles high (one tile is 64px X 64px). I want to show as much of the world as possible that the screen will allow (ie. larger screens show more of the world, smaller screens show less) while maintaining that my tiles stay square (otherwise they dont look good at all). This is where I'm stuck, I don't know how to create the camera to accomplish this. Right now the tiles look all stretched and horrible like this
Libgdx is very complicated and daunting. It also is a little more difficult to use it for 2d games; you have to worry about a camera, a viewport, make sure the aspect ratio is correct, working with different coordinate systems (virtual vs physical) etc. It felt like XNA did most of that behind the scenes for you. Perhaps it's just me though. However, while the documentation is pretty good, it's not so easy for beginners (or at least for me) who haven't dealt with game programming before.
Right now I'm struggling with doing something simple that I've been able to do in other frameworks easily (love2d and even XNA). I feel like I need a lot of handholding with libgdx, but for xna (and even love2d) I was able to easily grasp it and create something. This is actually part of the reason I've stopped working on my game (the other being I've been extremely busy).
Some things I'm struggling with:
I'm not sure why I can't grasp what libgdx has to offer, but I've been able to achieve all of this with other frameworks easily without having to worry about different coordinate systems, aspect ratios, etc. It just seems unnecessarily complicated to me.
Apparently if you're using bumblebee (like I am), it knows how to find the correct lib32 nvidia libs without needing lib32-nvidia-libgl. From the wiki:
What if you have two video cards (Intel and Nvidia)?
Make sure in your
/etc/rc.confyou have this:Only the interface has to be defined, as leaving the other options blank will set network to DHCP.
Just curious, is there a reason you can't use the built in System.Net.Sockets?
Hey I'll be there too. We should meet up!
Ah, that makes sense. Thank you.
Is it generally frowned upon to use
pacman -Sy footo install packages (even when there aren't updates like this)? Would it be better to just dopacman -S fooinstead?Have a look at the dbus wiki page. Specifically the part about
If you aren't using gnome, kde, or xfce then you can source scripts in /etc/X11/xinit/xinitrc.d in your ~/.xinitrc:
I don't use nautilus myself. However, are these windows shares you're trying to access? If so does smbclient work? Also this suggests you need dbus running although it is fairly old so I don't know if it's still relevant.
I didn't :P I got most of it from other sources since I can't draw too well myself.
Hope that helps!
It's been 2 months so far of very casual programming (2-3 hours every other night). I'm not completely finished but it's getting there. Of course my game is extremely simple. This is the state of it right now:
Oh dang I totally spaced and wrote the wrong name :P, was reading about it earlier and must have made a freudian slip.
Got some more work done on the Dungeon Dash UI:
It's starting to look like a real game now! The biggest challenge I faced was making small programming mistakes throughout the week. Typos, missing characters, etc; it's always the small things :P
Oops double posted.
I tried this the other day porting my XNA to MonoGame on Linux and it went alright. I started blogging about it but didn't finish because I came across a few issues. I was using the automatic content serialization to read in xml files for some of my content and MonoGame didn't like it.
The one thing that bothers me though is that assets have to be compiled to xnb files on Windows before using them with MonoGame. I couldn't ditch Windows altogether :(