Search Results

Search found 1932 results on 78 pages for 'andy thomas cramer'.

Page 12/78 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • How to reset the Xorg / xserver in 12.04 Precise Pangolin

    - by thomas
    xserver keeps crashing on my general user account both in unity 3d and 2d. It doesn't do it on the guest account. That's why I want to reset / rollback everything xserver related, hoping this is going to fix it. Most answers on this involve sudo dpkg-reconfigure xserver-xorg. However, this does nothing for me (generates no output) and I read in other forums, that it's deprecated. So, what's the current way to reset all xserver / xorg options; what's the alternative to sudo dpkg-reconfigure xserver-xorg ? Thanks Edit: X crashes during work, not before login or so. And the effect of a crash is, that I get thrown out of the session, not a freeze or machine crash.

    Read the article

  • Google analytics - drop in traffic

    - by Andy
    Bit of a general question here. We are in the process of converting a number of our clients from older web sites to new ones. The problem we are getting, and sorry for being so general here, is we are getting a sharp decline in traffic as reported on Google Analytics. It's not a gradual decline, it seems to hit almost as soon as the new site goes live. I've just got a few questions to see if there is something we are doing wrong: a) We are using the same analytics accounts going from old to new site. Is this a bad idea? b) The actual analytics code is integrated into the pages using a server-side include. IS this a bad idea? c) We structure our sites differently to our old site. IE. The old sites would pretty must have all the web pages in the root directory, and hyperlinks would be linked to the page files: EG. <a href="somepage.aspx">Link</a> Our new sites now have a directory structure that pretty much reflects the navigation structure, and hyper links link to the pages directory instead of the actual page: EG. <a href="/new-items/shoes/">New shoes</a> Is this a bad idea. I'm really searching for a needle in a haystack here. Would appriciate any help or advice as to why we are getting such a sharp and sudden drop in traffic. Again, so this is such a general question. Thanks in advance.

    Read the article

  • How to access files on a drive from an older system, mounted in a new system?

    - by David Thomas
    I've recently built a new system, after a rather large physical injury was sustained by my previous system (a precarious balance, and gravity, were not a happy mix). Surprisingly the /home drive of that system appears to have more-or-less survived the trauma. However... I decided to use a fresh drive for / (and swap) partition(s), and another fresh drive for the new /home. Now that's working, I decided to install the old /home drive (that I had assumed until now would be entirely dead and without capacity for use) into the new system to recover the files and data (so far as is possible). At this point I've run into a snag: I have no idea how to go about this (with Windows it was relatively easy, the new drive would be the latest character of the alphabet, and go from there). With 'disk utility' (System - Administration - Disk Utitlity) I've worked out which drive it is (/dev/sda) but clicking on 'mount' produces an error: 1: helper failed with: mount: according to mtab, /dev/sdb1 is already mounted on / mount failed ...if it is mounted on / I can't see it. I'm also moderately confused by the disk (device /dev/sda) being referred to as /dev/sdb1. Any and all insights would be incredibly welcome (I've already voted for: Idea #9063: New internal hard drives default automount at Brainstorm). Edited in response to Roland's request for a screenshot of disk utility: Details (so far as I know them): 40GB disk is / and swap, 1.0 TB Samsung is /home 1.0 TB Hitachi is from the old system (and was the old /home drive). Output from sudo fdisk -l pasted below: Disk /dev/sda: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000bef00 Device Boot Start End Blocks Id System /dev/sda1 1 121601 976760001 83 Linux Disk /dev/sdb: 40.0 GB, 40018599936 bytes 255 heads, 63 sectors/track, 4865 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00037652 Device Boot Start End Blocks Id System /dev/sdb1 * 1 4742 38084608 83 Linux /dev/sdb2 4742 4866 993281 5 Extended /dev/sdb5 4742 4866 993280 82 Linux swap / Solaris Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000e8d46 Device Boot Start End Blocks Id System /dev/sdc1 1 121602 976760832 83 Linux

    Read the article

  • Upcoming Events

    - by noreply(at)blogger.com (Thomas Kyte)
    I'll be doing four public events in the next week and a half or so. The first one is open to anyone - anywhere.  I'll be doing a live webinar on MAA - the Maximum Availability Architecture.  It will take place this Thursday April 12th at 10am PDT.  You should register online before then if you are interested.After that, I'll be off to Belfast Ireland to do a repeat of what I presented at Oracle OpenWorld in October.  This will be done in conjunction with Oracle and the UKOUG.  See http://www.ukoug.org/events/tom-kyte-seminar-and-asktom-live/ for details, it'll take place on Monday April 16th.When I'm done in Ireland - I'll be doing it all over again in London on Wednesday April 18th.  This is being put on by the UKOUG and details may be found here http://www.ukoug.org/events/tom-kyte-seminar/.Lastly - I'll be going from London to Las Vegas for IOUG's Collaborate.  I'll be doing a day of Real World Performance with Andrew Holdsworth and Graham Wood.  If you are going to Collaborate and want to spend all day Sunday in a technical session (probably cheaper than the tables....) - you might want to check it out.  Details on the session can be found here: http://events.ioug.org/p/cm/ld/fid=31#realHope to see you at one of the events... (well, I won't really see anyone at the first event but you know what I mean)

    Read the article

  • Transform coordinates from 3d to 2d without matrix or built in methods

    - by Thomas
    Not to long ago i started to create a small 3D engine in javascript to combine this with an html5 canvas. One of the issues I run into is how can you transform 3d to 2d coords. Since I cannot use matrices or built in transformation methods I need another way. I've tried implementing the next explanation + pseudo code: http://freespace.virgin.net/hugo.elias/routines/3d_to_2d.htm Unfortunately no luck there. I've replace all the input variables with data from my own camera and object classes. I have the following data: An object with a rotation, position vector and an array of 4 3d coords (its just a plane) a camera with a position and rotation vector the viewport - a square 600 x 600 surface. The example uses a zoom factor which I've set as 1 Most hits on google use either matrix calculations or don't implement camera rotation. Basic transformation should be like this: screen.x = x / z * zoom screen.y = y / z * zoom Can anyone point me in the right direction or explain to me howto achieve this? edit: Thanks for all your posts, I haven't been able to apply all this to my project yet but I hope to do this soon.

    Read the article

  • Can't copy from clipboard to any Java applet

    - by Thomas O
    The clipboard does not work with any Java applet on my install of Ubuntu 10.04. I am using the IcedTea plugin. I cannot copy/paste from Ubuntu to Java in either direction. However, IcedTea can copy to itself - that is, I can cut text from a Java applet and paste it into another part of that same applet. Other than this, clipboard support is fine across the rest of Ubuntu. Is there anything I can do to fix this?

    Read the article

  • Why does Clang/LLVM warn me about using default in a switch statement where all enumerated cases are covered?

    - by Thomas Catterall
    Consider the following enum and switch statement: typedef enum { MaskValueUno, MaskValueDos } testingMask; void myFunction(testingMask theMask) { switch theMask { case MaskValueUno: {}// deal with it case MaskValueDos: {}// deal with it default: {} //deal with an unexpected or uninitialized value } }; I'm an Objective-C programmer, but I've written this in pure C for a wider audience. Clang/LLVM 4.1 with -Weverything warns me at the default line: Default label in switch which covers all enumeration values Now, I can sort of see why this is there: in a perfect world, the only values entering in the argument theMask would be in the enum, so no default is necessary. But what if some hack comes along and throws an uninitialized int into my beautiful function? My function will be provided as a drop in library, and I have no control over what could go in there. Using default is a very neat way of handling this. Why do the LLVM gods deem this behaviour unworthy of their infernal device? Should I be preceding this by an if statement to check the argument?

    Read the article

  • Cannot logon to POP server on my VPS or recieve emails

    - by Andy
    I recently purchased an unmanaged VPS to host my business websites, however I am struggling to get the email accounts working as I have only ever had experience with shared hosting. The VPS is running CentOS and I have Webmin/Virtualmin installed. I have added my domain, which is lyke.org.uk, and that is working OK. However, when I've added a user and tried to access their email account using Apple Mail, I've been able to establish a SMTP connection but I've not been able to login using POP. Furthermore, I've set up squirrelmail and I can send an email to any email address from there but I haven't recieved any that I have sent to that email address from other accounts. I would very much appreciate any help or suggestions as I am completely new to VPS and web hosting without Plesk or cPanel.

    Read the article

  • What are the legal considerations when forking a BSD-licensed project?

    - by Thomas Owens
    I'm interested in forking a project released under a two-clause BSD license: Copyright (c) 2010 {copyright holder} All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the disclaimer at the end. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. (2) Neither the name of {copyright holder} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. DISCLAIMER THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. I've never forked a project before, but this project is very similar to something that I need/want. However, I'm not sure how far I'll get, so my plan is to pull the latest from their repository and start working. Maybe, eventually, I'll get it to where I want it, and be able to release it. Is this the right approach? How, exactly, does this impact forking of the project? How do I track who owns what components or sections (what's copyright me, what's copyright the original creators, once I start stomping over their code base)? Can I fork this project? What must I do prior to releasing, and when/if I decide to release the software derived from this BSD-licensed work?

    Read the article

  • gnome-control-center can't set display resolution under openbox

    - by Andy
    I'm running Ubuntu 11.10 with Openbox on my laptop. Since I need to plug different external displays into it and Openbox environment doesn't automatically pick them up, I thought the best solution I can come up with is to use gnome-control-center and it's display settings tool from within Openbox. But although this tool does detect monitors correctly, it can't do any change -- clicking Apply button just doesn't seem to do anything. So my questions are: 1) how to get this tool working? 2) how to run "Displays" tool directly from command-line, skipping control center? 3) is there a better way to automatically detect and set resolutions on internal/external monitors under Openbox? Please note I tried arandr too and it doesn't even work for my environment (doesn't detect external display plugging in at all). For what it's worth, my laptop is Lenovo G560, Ubuntu is x64 version with all the updates rolled over. Thanks for your consideration.

    Read the article

  • How to create an extensible rope in Box2D?

    - by Thomas
    Let's say I'm trying to create a ninja lowering himself down a rope, or pulling himself back up, all whilst he might be swinging from side to side or hit by objects. Basically like http://ninja.frozenfractal.com/ but with Box2D instead of hacky JavaScript. Ideally I would like to use a rope joint in Box2D that allows me to change the length after construction. The standard Box2D RopeJoint doesn't offer that functionality. I've considered a PulleyJoint, connecting the other end of the "pulley" to an invisible kinematic body that I can control to change the length, but PulleyJoint is more like a rod than a rope: it constrains maximum length, but unlike RopeJoint it constrains the minimum as well. Re-creating a RopeJoint every frame using a new length is rather inefficient, and I'm not even sure it would work properly in the simulation. I could create a "chain" of bodies connected by RotationJoints but that is also less efficient, and less robust. I also wouldn't be able to change the length arbitrarily, but only by adding and removing a whole number of links, and it's not obvious how I would connect the remainder without violating existing joints. This sounds like something that should be straightforward to do. Am I overlooking something?

    Read the article

  • Making next and previous button in html [on hold]

    - by Andy
    I am new to html and javascript. My problem is that I have a list of items. An example of the list of item is : request0 request1 request2 request3 request4 Now I need to make next and previous buttons to navigate through this list. For example; If I am currently at request1 and hit the next button request2 should shown. If I hit the previous button it should show resquest0. This is my very first project in html and javascript. I have no ideas how to implement it.

    Read the article

  • Symbolic link all files in directory to show in another directory?

    - by Thomas Clayson
    What I want is to be able to display all files that are ftp'd into /home/ftp in /srv/ftp /srv/ftp is password protected, and has files in it which I don't want to be accessible from the public ftp. So as such I wish that all files uploaded to /home/ftp are automatically symbolically linked (or otherwise) to /srv/ftp. Does this make sense? e.g. ls /srv/ftp: file.sh another.txt something_else.i386 then a user ftp's and drops a file in /home/ftp (or ssh, or whatever) ls /home/ftp: user_file.mk ls /srv/ftp: file.sh another.txt something_else.i386 user_file.mk I hope this makes sense. I have been told that this can probably be achieved using ln to create symbolic links, but I don't want to have to ssh in and create the links every time I (or someone else) puts files over ftp. Thanks! :)

    Read the article

  • ORACLE Cloud Summits

    - by Thomas Leopold
      Next Generation of Enterprise Cloud Computing     Markieren Sie sich den Termin für Ihren Oracle Enterprise Cloud Summit. 02. März 2011 in Hannover 03. März 2011 in Hannover 15. März 2011 in Frankfurt 22. März 2011 in München Bei Rückfragen schreiben Sie einfach eine E-Mail an [email protected].   Copyright © 2011, Oracle and/or its affiliates.All rights reserved. Contact Us | Legal Notices and Terms of Use | Privacy Statement

    Read the article

  • Creating an expandable, cross-platform compatible program "core".

    - by Thomas Clayson
    Hi there. Basically the brief is relatively simple. We need to create a program core. An engine that will power all sorts of programs with a large number of distinct potential applications and deployments. The core will be an analytics and algorithmic processor which will essentially take user-specific input and output scenarios based on the information it gets, whilst recording this information for reporting. It needs to be cross platform compatible. Something that can have platform specific layers put on top which can interface with the core. It also needs to be able to be expandable, for instance, modular with developers being able to write "add-ons" or "extensions" which can alter the function of the end program and can use the core to its full extent. (For instance, a good example of what I'm looking to create is a browser. It has its main core, the web-kit engine, for instance, and then on top of this is has a platform-specific GUI and can also have add-ons and extensions which can change the behavior of the program.) Our problem is that the extensions need to interface directly with the main core and expand/alter that functionality rather than the platform specific "layer". So, given that I have no experience in this whatsoever (I have a PHP background and recently objective-c), where should I start, and is there any knowledge/wisdom you can impart on me please? Thanks for all the help and advice you can give me. :) If you need any more explanation just ask. At the moment its in the very early stages of development, so we're just researching all possible routes of development. Thanks a lot

    Read the article

  • Is there any way to adjust the width of taskbar items on Gnome desktop?

    - by David Thomas
    Is there any way in which the width of items on the taskbar (or, rather, the lower panel) of the Gnome (2.32.0) desktop (Ubuntu 10.10) can be adjusted to take a more sensible width? While I can see the icons of the applications they represent, they seem a little over-compressed, given the width of the desktop/monitor resolution (1900 x 1080): Click the image, or this link, for a full-sized (1920x169, 169.7KB) graphic.

    Read the article

  • blacklist VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE

    - by Thomas Labensi
    I have an hp a310n pavillion I have installed an nvidia pci geforce card I want to blacklist the VGA compa[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 03)integrated graphics what do I need to do?? tom@tom-DM167A-ABA-a310n:~$ lspci | grep VGA 00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 03) 02:09.0 VGA compatible controller: NVIDIA Corporation NV11 [GeForce2 MX/MX 400] (rev b2) tom@tom-DM167A-ABA-a310n:~$ I'm using the nvidia via neuvoux and I want to really make sure I'm using the nvidia card

    Read the article

  • computer shows up twice, connection unknown

    - by Thomas G. Seroogy
    added two computers to Ubuntu One. One machine is windows. The windows version seems to work fine, and I started syncing a folder by placing it into the Ubuntu One folder. All files and folders are visible when I go to my account online. On Ubuntu machine. I selected to sync the Download folder. Shortly thereafter, I realized that one folder exceeded my storage max. I tried to un-sync the folder, but Ubuntu One and the Stop Syncing This Folder were not visible in the menu. Per Ubuntu instructions, I removed my Ubuntu computer from the list of syncing computers. Per Ubuntu instructions, I re-added the Ubuntu computer. However, I find that two computers by the same name are added on both the desktop app and on the web. Plus, I the connection is "unknown." I have removed and re-added the computer several times with the same results. In all cases, I remove the computers using the Ubuntu One desktop app, then removing them from my account on the web, removing the Ubuntu One password, and restart the Ubuntu One app. Problem remains. Thanks in advance for any replies and help.

    Read the article

  • My laptop with Linux/ Ubuntu isn't working

    - by Andy Campos
    I have a dell laptop with ubuntu linux. A day I tried to start it up and a black screen just appeared that says: GNU GRUB version1.98+20100804-5ubuntu3 (and these clickable options:) -Ubuntu, with Linux 2.6.35-22-generic -Ubuntu, with Linux 2.6.35-22-generic (recovery mode) -Memory test (memtest86+) -Memory test (memtest86+, serial console 115200) When I click the first one, a bunch of text appears like: mount: mounting /dev/disk/by-uuid/8396a225... failed: invalid argument mount: mounting /dev on /root/dev failed: no such file or directory mount: mounting /sys on /root/sys failed: no such file or directory mount: mounting /proc on /root/proc failed: no such file or directory Target file system doesn't have requested /sbin/init No init found. Try passing init= bootarg Enter 'help' for a list of built-in commands BusyBox v1.15.3 (Ubuntu 1:1.15.3-1ubuntu5) built-in shell (ash) (initramfs) When I enter 'help' a bunch more incomprehensible text appears. Whenever I press the enter key all that pops up is (intetramfs) If anyone can make rhyme or reason out of this please, please help me out so it can boot up normally and i can be set. If there's some kind of special code I have to type in or something I know nothing about computers.

    Read the article

  • Ubuntu One under KDE

    - by Andy Goss
    Currently, while Ubuntu One can be installed under KDE, Dolphin does not know about it, so it cannot set folders other than Ubuntu One to sync. There is a command line utility, "u1sdtool", which performs most if not all the functions you need. Setting the keyring password to be the same as your login won't prevent Ubuntu One asking you for it again on login. If you want to change it, install Seahorse, look for it in your menus as "Passwords and Keys", and right click over "Passwords: default", then select "Change Password". The various deleting tricks I've read about don't work for me. There is an ubuntuone-client-kde being developed, but no clue as to when it will appear in a stable repo. Any further advice will be welcomed by me and doubtless a few other KDE users.

    Read the article

  • Asynchronous update design/interaction patterns

    - by Andy Waite
    These days many apps support asynchronous updates. For example, if you're looking at a list of widgets and you delete one of them then rather than wait for the roundtrip to the server, the app can hide the one you deleted, giving immediate feedback. The actual deletion on the server will happen in the background. This can be seen in web apps, desktop apps, iOS apps, etc. But what about when the background operation fails. How should you feed back to the user? Should you restore the UI to the pre-deletion state? What about when multiple background operations fail together? Does this behaviour/pattern have a name? Perhaps something based on the Command pattern?

    Read the article

  • How to reset the Xorg / xserver?

    - by thomas
    xserver keeps crashing on my general user account both in unity 3d and 2d. It doesn't do it on the guest account. That's why I want to reset / rollback everything xserver related, hoping this is going to fix it. Most answers on this involve sudo dpkg-reconfigure xserver-xorg. However, this does nothing for me (generates no output) and I read in other forums, that it's deprecated. So, what's the current way to reset all xserver / xorg options; what's the alternative to sudo dpkg-reconfigure xserver-xorg ? Thanks Edit: X crashes during work, not before login or so. And the effect of a crash is, that I get thrown out of the session, not a freeze or machine crash.

    Read the article

  • In a SSL web application, what would be the vulnerabilities of using session based authentication?

    - by Thomas C. G. de Vilhena
    I'm not sure the term even exists, so let me explain what I mean by "session based authentication" through some pseudo-code: void PerformLogin(string userName, string password) { if(AreValidCredentials(userName, password)) { Session.Set("IsAuthenticated", true); } else { Message.Show("Invalid credentials!"); } } So the above method simply verifies the provided credentials are valid and then sets a session flag to indicate that the session user is authenticated. Under plain HTTP that is obviously unsafe, because anyone could hijack the session cookie/querystring and breach security. However, under HTTPS the session cookie/querystring is protected because client-server communication is encrypted, so I believe this authentication approach would be safe, wouldn't it? I'm asking this because I want to know how authentication tickets can improve web applications security. Thanks in advance!

    Read the article

  • Windows 2008 R2, UDDI 3.0 and No Admin Links

    - by Andy Morrison
    Windows 2008 R2 might end up giving me a heart attack at some point. Yesterday I installed and configured UDDI 3.0 as part of an ESB 2.0 install & config.  After configuring UDDI 3.0, if I browsed to the localhost/uddi virtual directory from IIS, all of the links would show up in UDDI.  If opened up IE and went to the UDDI site only the Home and Search links would show up. You've probably already guessed at what the "fix" was... I had to Run IE as Administrator.  Then when I browse to the UDDI site all of the links show up.

    Read the article

  • JBox2D Polygon Collisions Acting Strange

    - by andy
    I have been playing around with JBox2D and Slick2D and made a little demo with a ground object, a box object, and two different polygons. The problem I am facing is that the collision-detection for the polygons seems to be off (see picture below), but the box's collision works fine. My Code: Main Class package main; import org.jbox2d.common.Vec2; import org.jbox2d.dynamics.BodyType; import org.jbox2d.dynamics.World; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.BasicGameState; import org.newdawn.slick.state.StateBasedGame; import shapes.Box; import shapes.Polygon; public class State1 extends BasicGameState{ World world; int velocityIterations; int positionIterations; float pixelsPerMeter; int state; Box ground; Box box1; Polygon poly1; Polygon poly2; Renderer renderer; public State1(int state) { this.state = state; } @Override public void init(GameContainer gc, StateBasedGame game) throws SlickException { velocityIterations = 10; positionIterations = 10; pixelsPerMeter = 1f; world = new World(new Vec2(0.f, -9.8f)); renderer = new Renderer(gc, gc.getGraphics(), pixelsPerMeter, world); box1 = new Box(-100f, 200f, 40, 50, BodyType.DYNAMIC, world); ground = new Box(-14, -275, 50, 900, BodyType.STATIC, world); poly1 = new Polygon(50f, 10f, new Vec2[] { new Vec2(-6f, -14f), new Vec2(0f, -20f), new Vec2(6f, -14f), new Vec2(10f, 10f), new Vec2(-10f, 10f) }, BodyType.DYNAMIC, world); poly2 = new Polygon(0f, 10f, new Vec2[] { new Vec2(10f, 0f), new Vec2(20f, 0f), new Vec2(30f, 10f), new Vec2(30f, 20f), new Vec2(20f, 30f), new Vec2(10f, 30f), new Vec2(0f, 20f), new Vec2(0f, 10f) }, BodyType.DYNAMIC, world); } @Override public void update(GameContainer gc, StateBasedGame game, int delta) throws SlickException { world.step((float)delta / 180f, velocityIterations, positionIterations); } @Override public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException { renderer.render(); } @Override public int getID() { return this.state; } } Polygon Class package shapes; import org.jbox2d.collision.shapes.PolygonShape; import org.jbox2d.common.Vec2; import org.jbox2d.dynamics.Body; import org.jbox2d.dynamics.BodyDef; import org.jbox2d.dynamics.BodyType; import org.jbox2d.dynamics.FixtureDef; import org.jbox2d.dynamics.World; import org.newdawn.slick.Color; public class Polygon { public float x, y; public Color color; public BodyType bodyType; org.newdawn.slick.geom.Polygon poly; BodyDef def; PolygonShape ps; FixtureDef fd; Body body; World world; Vec2[] verts; public Polygon(float x, float y, Vec2[] verts, BodyType bodyType, World world) { this.verts = verts; this.x = x; this.y = y; this.bodyType = bodyType; this.world = world; init(); } public void init() { def = new BodyDef(); def.type = bodyType; def.position.set(x, y); ps = new PolygonShape(); ps.set(verts, verts.length); fd = new FixtureDef(); fd.shape = ps; fd.density = 2.0f; fd.friction = 0.7f; fd.restitution = 0.5f; body = world.createBody(def); body.createFixture(fd); } } Rendering Class package main; import org.jbox2d.collision.shapes.PolygonShape; import org.jbox2d.collision.shapes.ShapeType; import org.jbox2d.common.MathUtils; import org.jbox2d.common.Vec2; import org.jbox2d.dynamics.Body; import org.jbox2d.dynamics.Fixture; import org.jbox2d.dynamics.World; import org.newdawn.slick.Color; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.geom.Polygon; import org.newdawn.slick.geom.Transform; public class Renderer { World world; float pixelsPerMeter; GameContainer gc; Graphics g; public Renderer(GameContainer gc, Graphics g, float ppm, World world) { this.world = world; this.pixelsPerMeter = ppm; this.g = g; this.gc = gc; } public void render() { Body current = world.getBodyList(); Vec2 center = current.getLocalCenter(); while(current != null) { Vec2 pos = current.getPosition(); g.pushTransform(); g.translate(pos.x * pixelsPerMeter + (0.5f * gc.getWidth()), -pos.y * pixelsPerMeter + (0.5f * gc.getHeight())); Fixture f = current.getFixtureList(); while(f != null) { ShapeType type = f.getType(); g.setColor(getColor(current)); switch(type) { case POLYGON: { PolygonShape shape = (PolygonShape)f.getShape(); Vec2[] verts = shape.getVertices(); int count = shape.getVertexCount(); Polygon p = new Polygon(); for(int i = 0; i < count; i++) { p.addPoint(verts[i].x, verts[i].y); } p.setCenterX(center.x); p.setCenterY(center.y); p = (Polygon)p.transform(Transform.createRotateTransform(current.getAngle() + MathUtils.PI, center.x, center.y)); p = (Polygon)p.transform(Transform.createScaleTransform(pixelsPerMeter, pixelsPerMeter)); g.draw(p); break; } case CIRCLE: { f.getShape(); } default: } f = f.getNext(); } g.popTransform(); current = current.getNext(); } } public Color getColor(Body b) { Color c = new Color(1f, 1f, 1f); switch(b.m_type) { case DYNAMIC: if(b.isActive()) { c = new Color(255, 123, 0); } else { c = new Color(99, 99, 99); } break; case KINEMATIC: break; case STATIC: c = new Color(111, 111, 111); break; default: break; } return c; } } Any help with fixing the collisions would be greatly appreciated, and if you need any other code snippets I would be happy to provide them.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >