Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

129 Neutral

About Wibbs

  • Rank
  1. Hey all,   I have just started working with libgdx, and have run into my first problem. I have a simple program that switches a desktop application from windowed mode to fullscreen and back again. If I start the program in windowed mode, it initially displays fine. When I toggle to full screen it is also OK.   However, when I toggle back to windowed mode the screen goes completely black. The application remains responsive though, and if I toggle again it will go back to fullscreen and display correctly.   I am using 64-bit Windows 7 with the IntelliJ IDEA IDE.   Any help with working out why it is doing this would be greatly appreciated.   A minimal example that displays the issue is shown below:     public class MyGdxGame extends ApplicationAdapter { @Override public void create () { fullScreen = false; } @Override public void render () { Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (Gdx.input.isKeyPressed(Input.Keys.TAB)) { fullScreen = !fullScreen; DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode(); Gdx.graphics.setDisplayMode(currentMode.width, currentMode.height, fullScreen); } } private boolean fullScreen; }
  2. Wibbs

    Matrix problem

    Hey all, I have a matrix problem that I've been trying to work out for about a week now but with no success, and I was hoping someone might beable to shed some light on it for me. I have a scene graph where individual nodes store their scale, rotation and translation relative to their parent node. I also store the total forward and reverse transformation for each node so I can convert freely between global and local coordinates. What I am struggling with is how to rotate a particular node around an arbitrary point in global coordinates. I know how to get: - The matrix that represents the rotation about the point in global coordinates(Trans(-point) * Rotate * Trans(point) - The global coordinates of the node I want to rotate What I don't understand how to calculate is the change in local scale, rotation and translation for the node being rotated that gives the equivalent transformation. Any help would be greatly appreciated. Wibbs
  3. Thanks all for your help - its made me realise that the issue isn't so much with the way I design the event dispatcher, but more with the way I design the code that uses it.
  4. But can't it lead to a situation where listeners in the pending queue need to be made aware of events being dispatched?
  5. Hey all, I'm in the process of coding up an event dispatcher for my game, and I've run into a problem I'm not sure how to deal with. The dispatcher registers event listeners against particular event types by adding them to lists, and when events are triggered the dispatcher iterates over the list for the event type and calls each listener in turn. The problem I have is working out how to deal with what happens when the calling of one of the event listeners leads to code which wants to add another listener to the list that's being iterated over as this causes an exception. I've thought about having a pending list, which is added to until the iteration completes, but I think that will just move the problem rather than solving it altogether. To be honest I am completely stumped on this and would welcome any guidance. Thanks, Wibbs
  6. Hi all, I have a 2D matrix problem that I am struggling with, and I would be grateful for any help you can give... I have a shape made up of a number of points with a given specified centre. I then apply an arbitary number of the following operations to it in a particular order: - Translation - Rotation about an arbitary point - Scale relative to an arbitary point I know how to represent each of these by a matrix or set of matrices, and I can concatenate the operations to give a single, composite matrix. However, what I would like to be able to do is represent the combination of the various operations I have applied as: - A single translation from the origin followed by - A single scale relative to the origin followed by - A single rotation about the specified centre of the object Is this possible? If so, I would be extremely grateful for any pointers. Thanks, Wibbs
  7. No, not UI widgets - I have good clean seperation for these. The things I am talking about are actual 'actors' within the game world. The game is card based, and certain aspects of their placement are sometimes user configurable. What I would like to be able to do is have the overall algorithm that decides the placement of the cards on the server, but for there to be parameters within it which individual clients can have set differently (typically within certain bounds). Different clients can set these seperately for the same actors, which could and probably would lead to the position of some actors varying from client to client.
  8. In the example I was considering they are deciding the way elements of the game are positioned on the screen. Although the server has ownership of the overall algorithm that is used, clients have some configurability with some of the paramaters that the algorithm uses.
  9. Hi all, I have successfully implemented a simple client server model within my game, which also makes heavy use of Lua scripting. However, I've run into an issue I would appreciate some advice on. There are a number of cases where the server has an algorithm, which is represented by a Lua function loaded from script, but individual clients can have different values for the parameters that drive it, resulting in different algorithm outputs. What I am stuck with is how to make sure that the algorithm is run with the correct parameters for each client. The only solution I can think of is for the server to request copies of the parameters from each client and store them ready for use, but this seems very inelegent, and I was wondering if there was a solution I am overlooking. Any advice would be extremely helpful. Thanks, Phil
  10. Wibbs

    Can This Be Done? [SFML]

    This is possible with the most recent version of SFML, which allows you to render directly to images. PATrainwreck is correct though - the SFML forums would be a much better place to ask this kind of thing, and the developer is very good at responding quickly.
  11. Thanks, That's the conclusion I'd come to, but wanted to check whether there was a way the contents of a folder could be treated as a single entity rather than having to hash each file seperately. Wibbs
  12. Hey all, The game I am writing uses a client/server architecture, and I would like to add a check that the server initiates to see if some key files on the client's machine are what they should be. I would appreciate any pointers as to the most efficient way of doing this - at present I have managed to arrange the data so that all files within a couple of folders need checking, and I was also wondering if there is a more efficient way of doing this rather than checking each file individually. Thanks in advance, Wibbs
  13. Cool thanks - would it preferable to use the shared app directory or the user specific one? [Edited by - Wibbs on November 30, 2010 5:29:17 AM]
  14. Hi all, I am working on a game where the user will be required to download content of different types, and I would like to ask for clarification on where the best place is to save this information. There will be both official and user made game levels, and I am a little unsure of where to save them. At present they are going into a folder in: C:\Documents and Settings\All Users\Application Data which I am accessing through: Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) I have a couple of queries: Are all users guaranteed to be able to access this folder for reading and writing? Would it be preferable to save to the specific users application data folder? If so then is it OK to expect each windows user account to have to download content seperately? I am using Windows XP. Are there any variations in practice between this, Vista and Windows 7? Thanks in advance for your help. Phil
  15. Thanks for the pointers. This is the rough code I've ended up with... First I get info on the local host's network interfaces: hostIPAddressesAndSubnetMasks = new Dictionary<IPAddress, IPAddress>(); // get the network interfaces for the host machine NetworkInterface[] hostNetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); // for each interface, loop through and get all of the unicast IP addresses and their associated subnet masks foreach (NetworkInterface interfaceToCheck in hostNetworkInterfaces) { if (interfaceToCheck.NetworkInterfaceType == NetworkInterfaceType.Loopback) { continue; } UnicastIPAddressInformationCollection IPAddressInfoCollection = interfaceToCheck.GetIPProperties().UnicastAddresses; foreach (UnicastIPAddressInformation info in IPAddressInfoCollection) { if (!hostIPAddressesAndSubnetMasks.ContainsKey(info.Address)) { hostIPAddressesAndSubnetMasks.Add(info.Address, info.IPv4Mask); } } } I have a utility function which returns the network address for a given IP address and subnet mask: protected IPAddress GetNetworkAddressFromIPAddress(IPAddress address, IPAddress subnetMask) { byte[] ipAddressAsBytes = address.GetAddressBytes(); byte[] subnetMaskAsBytes = subnetMask.GetAddressBytes(); if (ipAddressAsBytes.Length != subnetMaskAsBytes.Length) { throw new ArgumentException("address and subnet mask must be the same length"); } byte[] networkAddress = new byte[ipAddressAsBytes.Length]; for (int i = 0; i < networkAddress.Length; i++) { networkAddress = (byte)(ipAddressAsBytes & (subnetMaskAsBytes)); } return new IPAddress(networkAddress); } And finally, I have a function which checks a given address as follows: public bool IsInternal(int ipAddress) { IPAddress addressToCheck = new IPAddress(ipAddress); foreach (KeyValuePair<IPAddress, IPAddress> localAddress in hostIPAddressesAndSubnetMasks) { IPAddress localNetworkAddress = GetNetworkAddressFromIPAddress(localAddress.Key, localAddress.Value); IPAddress addressToCheckNetworkAddress = GetNetworkAddressFromIPAddress(addressToCheck, localAddress.Value); if (localNetworkAddress.Equals(addressToCheckNetworkAddress)) { return true; } } return false; } I know there needs to be a fair bit more error checking and such like, but I would appreciate it if anyone could point out if I'm missing anything obvious. Thanks, Phil
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!