Search Results

Search found 8929 results on 358 pages for 'multi touch'.

Page 15/358 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • iPhone "touchesBegan" and "touchesMoved" message ... do not move to centre of touch

    - by Nippysaurus
    I am modifying the "MoveMe" example from the apple web site. When I get the "touchesMoved" message I move the centre of the target view to the centre of the touch. Is there a way that when the touch starts ("touchesBegan" message) I can remember the offset from the target view and keep that offset. Let me know if this is hard to understand and I will try to explain it a bit better.

    Read the article

  • Detect multitouch (two fingers touch) on a sprite to apply pinch zoom behaviour

    - by Tahreem
    I am using andengine, want to move, zoom and rotate multiple sprites individually on a scene. I have achieved "move" but for pinch zoom i am unable to get the event to two fingers' touch. Below is the code: public class Main extends SimpleBaseGameActivity { private Camera camera; private BitmapTextureAtlas mBitmapTextureAtlas; private ITextureRegion mFaceTextureRegion; private ITextureRegion mFaceTextureRegion2; Sprite face2; private static final int CAMERA_WIDTH = 800; private static final int CAMERA_HEIGHT = 480; @Override public EngineOptions onCreateEngineOptions() { camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT); EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy( CAMERA_WIDTH, CAMERA_HEIGHT), camera); return engineOptions; } @Override protected void onCreateResources() { BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/"); this.mBitmapTextureAtlas = new BitmapTextureAtlas( this.getTextureManager(), 1024, 1600, TextureOptions.NEAREST); BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, // this, "ui_ball_1.png", 0, 0, 1, 1), // this.getVertexBufferObjectManager()); this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory .createFromAsset(this.mBitmapTextureAtlas, this, "ui_ball_1.png", 0, 0); this.mFaceTextureRegion2 = BitmapTextureAtlasTextureRegionFactory .createFromAsset(this.mBitmapTextureAtlas, this, "ui_ball_1.png", 0, 0); this.mBitmapTextureAtlas.load(); this.mEngine.getTextureManager().loadTexture(this.mBitmapTextureAtlas); } @Override protected Scene onCreateScene() { this.mEngine.registerUpdateHandler(new FPSLogger()); final Scene scene = new Scene(); scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f)); final float centerX = (CAMERA_WIDTH - this.mFaceTextureRegion .getWidth()) / 2; final float centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion .getHeight()) / 2; final Sprite face = new Sprite(centerX, centerY, this.mFaceTextureRegion, this.getVertexBufferObjectManager()) { @Override public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) { this.setPosition(pSceneTouchEvent.getX() - this.getWidth() / 2, pSceneTouchEvent.getY() - this.getHeight() / 2); return true; } }; face.setScale(2); scene.attachChild(face); scene.registerTouchArea(face); face2 = new Sprite(200, 200, this.mFaceTextureRegion2, this.getVertexBufferObjectManager()) { @Override public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) { switch(pSceneTouchEvent.getAction()){ case TouchEvent.ACTION_DOWN: int count = pSceneTouchEvent.getMotionEvent().getPointerCount() ; for(int i= 0; i <count; i++) { int id = pSceneTouchEvent.getMotionEvent().getPointerId(i); } break; case TouchEvent.ACTION_MOVE: this.setPosition(pSceneTouchEvent.getX() -this.getWidth() / 2, pSceneTouchEvent.getY()-this.getHeight() / 2); break; case TouchEvent.ACTION_UP: break; } return true; } }; face2.setScale(2); scene.attachChild(face2); scene.registerTouchArea(face2); scene.setTouchAreaBindingOnActionDownEnabled(true); return scene; } } This line int count = pSceneTouchEvent.getMotionEvent().getPointerCount() ; should set 2 to the count variable if i touch the sprite with to fingers, then i can apply zooming functionality (setScale method) on the sprite by getting the distance between the coordinates of two fingers. Can anyone help me? why it does not detect two fingers? and without this how can i zoom the sprite on pinch of two fingers? I am very new to game development, any help would be appreciated. Thanks in advance.

    Read the article

  • Box Selection and Multi-Line Editing with VS 2010

    - by ScottGu
    This is the twenty-second in a series of blog posts I’m doing on the VS 2010 and .NET 4 release. I’ve already covered some of the code editor improvements in the VS 2010 release.  In particular, I’ve blogged about the Code Intellisense Improvements, new Code Searching and Navigating Features, HTML, ASP.NET and JavaScript Snippet Support, and improved JavaScript Intellisense.  Today’s blog post covers a small, but nice, editor improvement with VS 2010 – the ability to use “Box Selection” when performing multi-line editing.  This can eliminate keystrokes and enables some slick editing scenarios. [In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu] Box Selection Box selection is a feature that has been in Visual Studio for awhile (although not many people knew about it).  It allows you to select a rectangular region of text within the code editor by holding down the Alt key while selecting the text region with the mouse.  With VS 2008 you could then copy or delete the selected text. VS 2010 now enables several more capabilities with box selection including: Text Insertion: Typing with box selection now allows you to insert new text into every selected line Paste/Replace: You can now paste the contents of one box selection into another and have the content flow correctly Zero-Length Boxes: You can now make a vertical selection zero characters wide to create a multi-line insert point for new or copied text These capabilities can be very useful in a variety of scenarios.  Some example scenarios: change access modifiers (private->public), adding comments to multiple lines, setting fields, or grouping multiple statements together. Great 3 Minute Box-Selection Video Demo Brittany Behrens from the Visual Studio Editor Team has an excellent 3 minute video that shows off a few cool VS 2010 multi-line code editing scenarios with box selection:   Watch it to learn a few ways you can use this new box selection capability to optimize your typing in VS 2010 even further: Hope this helps, Scott P.S. You can learn more about the VS Editor by following the Visual Studio Team Blog or by following @VSEditor on Twitter.

    Read the article

  • Help trying to get two-finger scrolling to work on Asus UL80VT

    - by Dan2k3k4
    Multi-touch works fine on Windows 7 with: two-fingers scroll vertical and horizontally, two-finger tap for middle click, and three-finger tap for right click. However with Ubuntu, I've never been able to get multi-touch to "save" and work, I was able to get it to work a few times but after restarting - it would just reset back. I have the settings for two-finger scrolling on: Mouse and Touchpad Touchpad Two-finger scrolling (selected) Enable horizontal scrolling (ticked) The cursor stops moving when I try to scroll with two fingers, but it doesn't actually scroll the page. When I perform xinput list, I get: Virtual core pointer id=2 [master pointer (3)] ? Virtual core XTEST pointer id=4 [slave pointer (2)] ? ETPS/2 Elantech ETF0401 id=13 [slave pointer (2)] I've tried to install some 'synaptics-dkms' bug-fix (from a few years back) but that didn't work, so I removed that. I've tried installing 'uTouch' but that didn't seem to do anything so removed it. Here's what I have installed now: dpkg --get-selections installed-software grep 'touch\|mouse\|track\|synapt' installed-software libsoundtouch0 --- install libutouch-evemu1 --- install libutouch-frame1 --- install libutouch-geis1 --- install libutouch-grail1 --- install printer-driver-ptouch --- install ptouch-driver --- install xserver-xorg-input-multitouch --- install xserver-xorg-input-mouse --- install xserver-xorg-input-vmmouse --- install libnetfilter-conntrack3 --- install libxatracker1 --- install xserver-xorg-input-synaptics --- install So, I'll start again, what should I do now to get two-finger scrolling to work and ensure it works after restarting? Also doing: synclient TapButton1=1 TapButton2=2 TapButton3=3 ...works but doesn't save after restarting. However doing: synclient VertTwoFingerScroll=1 HorizTwoFingerScroll=1 Does NOT work to fix the two-finger scrolling. Output of: cat /var/log/Xorg.0.log | grep -i synaptics [ 4.576] (II) LoadModule: "synaptics" [ 4.577] (II) Loading /usr/lib/xorg/modules/input/synaptics_drv.so [ 4.577] (II) Module synaptics: vendor="X.Org Foundation" [ 4.577] (II) Using input driver 'synaptics' for 'ETPS/2 Elantech ETF0401' [ 4.577] (II) Loading /usr/lib/xorg/modules/input/synaptics_drv.so [ 4.584] (--) synaptics: ETPS/2 Elantech ETF0401: x-axis range 0 - 1088 [ 4.584] (--) synaptics: ETPS/2 Elantech ETF0401: y-axis range 0 - 704 [ 4.584] (--) synaptics: ETPS/2 Elantech ETF0401: pressure range 0 - 255 [ 4.584] (--) synaptics: ETPS/2 Elantech ETF0401: finger width range 0 - 16 [ 4.584] (--) synaptics: ETPS/2 Elantech ETF0401: buttons: left right middle double triple scroll-buttons [ 4.584] (--) synaptics: ETPS/2 Elantech ETF0401: Vendor 0x2 Product 0xe [ 4.584] (--) synaptics: ETPS/2 Elantech ETF0401: touchpad found [ 4.588] (**) synaptics: ETPS/2 Elantech ETF0401: (accel) MinSpeed is now constant deceleration 2.5 [ 4.588] (**) synaptics: ETPS/2 Elantech ETF0401: MaxSpeed is now 1.75 [ 4.588] (**) synaptics: ETPS/2 Elantech ETF0401: AccelFactor is now 0.154 [ 4.589] (--) synaptics: ETPS/2 Elantech ETF0401: touchpad found Tried installing synaptiks but that didn't seem to work either, so removed it. Temporary Fix (works until I restart) Doing the following commands: modprobe -r psmouse modprobe psmouse proto=imps Works but now xinput list shows up as: Virtual core pointer id=2 [master pointer (3)] ? Virtual core XTEST pointer id=4 [slave pointer (2)] ? ImPS/2 Generic Wheel Mouse id=13 [slave pointer (2)] Instead of Elantech, and it gets reset when I reboot. Solution (not ideal for most people) So, I ended up reinstalling a fresh 12.04 after indirectly playing around with burg and plymouth then removing plymouth which removed 50+ packages (I saw the warnings but was way too tired and assumed I could just 'reinstall' them all after (except that didn't work). Right now xinput list shows up as: ? Virtual core pointer --- id=2 [master pointer (3)] ? ? Virtual core XTEST pointer --- id=4 [slave pointer (2)] ? ? ETPS/2 Elantech Touchpad --- id=13 [slave pointer (2)] grep 'touch\|mouse\|track\|synapt' installed-software libnetfilter-conntrack3 --- install libsoundtouch0 --- install libutouch-evemu1 --- install libutouch-frame1 --- install libutouch-geis1 --- install libutouch-grail1 --- install libxatracker1 --- install mousetweaks --- install printer-driver-ptouch --- install xserver-xorg-input-mouse --- install xserver-xorg-input-synaptics --- install xserver-xorg-input-vmmouse --- install cat /var/log/Xorg.0.log | grep -i synaptics [ 4.890] (II) LoadModule: "synaptics" [ 4.891] (II) Loading /usr/lib/xorg/modules/input/synaptics_drv.so [ 4.892] (II) Module synaptics: vendor="X.Org Foundation" [ 4.892] (II) Using input driver 'synaptics' for 'ETPS/2 Elantech Touchpad' [ 4.892] (II) Loading /usr/lib/xorg/modules/input/synaptics_drv.so [ 4.956] (II) synaptics: ETPS/2 Elantech Touchpad: ignoring touch events for semi-multitouch device [ 4.956] (--) synaptics: ETPS/2 Elantech Touchpad: x-axis range 0 - 1088 [ 4.956] (--) synaptics: ETPS/2 Elantech Touchpad: y-axis range 0 - 704 [ 4.956] (--) synaptics: ETPS/2 Elantech Touchpad: pressure range 0 - 255 [ 4.956] (--) synaptics: ETPS/2 Elantech Touchpad: finger width range 0 - 15 [ 4.956] (--) synaptics: ETPS/2 Elantech Touchpad: buttons: left right double triple [ 4.956] (--) synaptics: ETPS/2 Elantech Touchpad: Vendor 0x2 Product 0xe [ 4.956] (--) synaptics: ETPS/2 Elantech Touchpad: touchpad found [ 4.980] () synaptics: ETPS/2 Elantech Touchpad: (accel) MinSpeed is now constant deceleration 2.5 [ 4.980] () synaptics: ETPS/2 Elantech Touchpad: MaxSpeed is now 1.75 [ 4.980] (**) synaptics: ETPS/2 Elantech Touchpad: AccelFactor is now 0.154 [ 4.980] (--) synaptics: ETPS/2 Elantech Touchpad: touchpad found So, if all else fails, reinstall Linux :/

    Read the article

  • UML Diagrams of Multi-Threaded Applications

    - by PersonalNexus
    For single-threaded applications I like to use class diagrams to get an overview of the architecture of that application. This type of diagram, however, hasn’t been very helpful when trying to understand heavily multi-threaded/concurrent applications, for instance because different instances of a class "live" on different threads (meaning accessing an instance is save only from the one thread it lives on). Consequently, associations between classes don’t necessarily mean that I can call methods on those objects, but instead I have to make that call on the target object's thread. Most literature I have dug up on the topic such as Designing Concurrent, Distributed, and Real-Time Applications with UML by Hassan Gomaa had some nice ideas, such as drawing thread boundaries into object diagrams, but overall seemed a bit too academic and wordy to be really useful. I don’t want to use these diagrams as a high-level view of the problem domain, but rather as a detailed description of my classes/objects, their interactions and the limitations due to thread-boundaries I mentioned above. I would therefore like to know: What types of diagrams have you found to be most helpful in understanding multi-threaded applications? Are there any extensions to classic UML that take into account the peculiarities of multi-threaded applications, e.g. through annotations illustrating that some objects might live in a certain thread while others have no thread-affinity; some fields of an object may be read from any thread, but written to only from one; some methods are synchronous and return a result while others are asynchronous that get requests queued up and return results for instance via a callback on a different thread.

    Read the article

  • Multi Threading - How to split the tasks

    - by Motig
    if I have a game engine with the basic 'game engine' components, what is the best way to 'split' the tasks with a multi-threaded approach? Assuming I have the standard components of: Rendering Physics Scripts Networking And a quad-core, I see two ways of multi-threading: Option A ('Vertical'): Using this approach I can allow one core for each component of the engine; e.g. one core for the Rendering task, one for the Physics, etc. Advantages: I do not need to worry about thread-safety within each component I can take advantage of special optimizations provided for single-threaded access (e.g. DirectX offers a flag that can be set to tell it that you will only use single-threading) Option B ('Horizontal'): Using this approach, each task may be split up into 1 <= n <= numCores threads, and executed simultaneously, one after the other. Advantages: Allows for work-sharing, i.e. each thread can take over work still remaining as the others are still processing I can take advantage of libraries that are designed for multi-threading (i.e. ... DirectX) I think, in retrospect, I would pick Option B, but I wanted to hear you guys' thoughts on the matter.

    Read the article

  • Play PlayStation Games on a Rooted Nook Simple Touch

    - by Jason Fitzpatrick
    Just when you feel like you’ve seen it all, some guy comes along and shows you how he can play original PlayStation games on his ebook reader. Check out the video to see the surprisingly full-speed–albeit black and white–graphics in action. The secret sauce in Sean’s cool setup? He’s rooted the device and installed Free PlayStation Emulator (FPSE) on it–along with the NoRefresh hack–to enjoy touch-screen controls and PS emulation. The whole thing is shockingly smooth; once you get past the choppy intro videos, the games run at full speed. [via Hack A Day] HTG Explains: Why Do Hard Drives Show the Wrong Capacity in Windows? Java is Insecure and Awful, It’s Time to Disable It, and Here’s How What Are the Windows A: and B: Drives Used For?

    Read the article

  • Mod Puts Mac OS 7 On the Nook Touch

    - by Jason Fitzpatrick
    Thanks to a mac-hardware emulator for Android, it’s now possible to run Mac OS 7 on the Nook Touch (or other Android-based tablet). If you’ve been looking for some retro-goodness to dump on your Nook or tablet–Oregon Trail anyone?–this simple hack will certainly help. Hit up the link below for additional screenshots and more information. Mini vMac for Android Development Thread [via MikeCanex] HTG Explains: What Is Two-Factor Authentication and Should I Be Using It? HTG Explains: What Is Windows RT and What Does It Mean To Me? HTG Explains: How Windows 8′s Secure Boot Feature Works & What It Means for Linux

    Read the article

  • Can't use my keyboard nor the touch pad while installing on a Dell Vostro 1510

    - by Kaushal Singh
    I am stuck with a very annoying problem which does not allow me to even install Ubuntu on my laptop (Dell Vostro 1510). In a simple walk through of the problematic scenario... I boot the Ubuntu from a boot able CD. I got to a point where it ask for the language options, I select the English as my option using arrows keys and press enter. Then the option come where a.) try from the live cd b.) install ubuntu c.) etc etc Is needed to be selected. For which I press enter. Once I press enter... In any of the next steps of installing Ubuntu, my keypad and touch pad does not work. P.S.: My Batteries are completely dried Up... Can't use batteries. Does this problem has anything to do with batteries?

    Read the article

  • Art of Touch : Le nouveau site de Microsoft pour la création et le partage de l'art numérique en HTML5 avec ses souris tactiles

    Art of Touch : Le nouveau site de Microsoft pour la création et le partage de l'art numérique avec ses souris tactiles Microsoft vient de procéder au lancement du programme « Art of Touch », qui permet aux utilisateurs ayant un navigateur compatible HTML5 de créer et partager de l'art numérique. Le projet « Art of Touch » est une campagne marketing pour la famille de souris tactiles (Touch Mouse, Arc Touch Mouse et Explorer Touch Mouse) commercialisées par l'éditeur. Le site dédié au programme permet aux internautes de créer des oeuvres d'arts originales. Ils peuvent utiliser trois pinceaux différents et p...

    Read the article

  • Rotate view matrix based on touch coordinates

    - by user1055947
    I'm working on an Android game where I need to rotate the camera around the origin based on the user dragging their finger. My view matrix has initial position of sitting on the negative z and facing origin. I have succeeded in moving the camera through rotation left or right, up or down based on the user dragging the finger, but my problem is obviously that after I drag my finger up/down and rotate say 90 degrees so my intial position of -z is now +y and still facing origin, if I drag my finger left/right I want to rotate from +y to +x, but what happens is it rotates around the pole +y. This is to be expected as I am mapping 2D touch drag coords to 3D space, but I dont know where to start trying to do what I want. Perhaps someone can point me in the right direction, I've been googling for a while now but I don't know what I want to do is called! Edit __ What I was looking for is called an ArcBall, google it for lots of info on it.

    Read the article

  • Will we ever lose the human touch?

    - by divya.malik
    I was at a conference two weeks ago, which was targeted to sales and marketing professionals. The discussions around the changing scenario in sales was very interesting. More and more of selling is moving to the internet- sales people are delivering more of their presentations online, or via the phone. Budget constraints and new technologies have dramatically decreased the need for face-to-face interactions. At the same time, customers are also researching for products on their own, taking the advice of peers, making up their mind, and then contacting the vendor. That takes care of more than half of the usual selling process. But humans are social animals, and because of that I believe that despite these changing trends and technologies, the need to maintain the human touch will always be necessary. One of the presenters at the conference shared this video, which stayed in my mind.

    Read the article

  • Syncing my iPod Touch (And Others)

    - by Benjamin Hannah
    libimobiledevice doesn't work for me. I've got Ubuntu 11.10 and I'm trying to put music on to my iPod Touch 4Gen running iOS 5.0.1. I have tried every program available in the Ubuntu software center for sycing iPods and I get basically the same response from each one: "[cannot apply changes etc, ect, etc]" I've tried rigorously with Banshee and Rythmbox with no success. I've even tried running iTunes on Windows XP in VirtualBox with no success. I've tried running iTunes through Wine and it results in an error message saying something along the lines of "[Please install Apple Application Support and then reinstall iTunes]". I am considering Jailbreaking my iPod but I cannot find Absinthe that works with my iPod and with Ubuntu. In addition I'm not sure how ** works with Ubuntu. I'm really in a pickle here. It would be ever so helpful if I could indeed have some help with this issue.

    Read the article

  • Getting Wacom Bamboo Pen + Touch pressure sensitivy in GIMP

    - by Bart van Heukelom
    I've installed my Wacom Bamboo Pen + Touch (CTH-460) in Ubuntu (at least on one system, not another) and the pen works well for controlling the mouse cursor. However, I can't get pressure sensitivity to work in GIMP. I have 4 extra devices in the input devices settings screen now, two of which are the pen and eraser. I've set them both from Disabled to Screen, and left the default settings intact. However, after saving I still don't see any pressure options in the brush tool's options. I've also tried setting the mode to Window instead, but it makes no difference regarding pressure sensitivity. There are no other modes. The pressure works out-of-the-box in Blender (grease pen) so it must be something in GIMP. What can be wrong? Why don't the options appear? How can I debug this?

    Read the article

  • How to disable the auto resizing of Windows when you touch the top or bottom

    - by L. D. James
    Can someone tell me how to stop the autoresizing behavior of Windows in Ubuntu 14.04 when you touch the top or bottom when resizing the window. There is an undesirable effect of the the bottom resizing all the way to the bottom when you only want to resize the top, or vice-versa. In the past it was possible to disable this effect by unchecking grid in CCSM. Then came Unity Tweak tool which made it easy to remove. You could remove it by turning off Window snapping and Hotcorners. Now in Ubuntu 14.04 I have all those feature turned off and yet I can't resize only the top or only the bottom without the other end automatically moving.

    Read the article

  • Hover alternatve for touch devices [migrated]

    - by Joshua Frank
    I'm building a standard infographic where you mouse over a region and the image changes as you move. For instance, imagine a map of the world, and when you mouse over a country, that country glows and a panel shows statistics about that country. The implementation is to have a separate image for the glowing country, and a div element with the statistics, and the code shows these additional elements on a hover over the country. The question is: what should this do on a tablet, where there's no hover event? What's a good alternative navigation metaphor for this kind of situation on touch-only devices?

    Read the article

  • touch in guiTexture

    - by Mitananda
    Before time in my game start. i want there will show a guiTexture.. if i touch this guiTexture, that will hidden and the time game will start. I try to make a script but it doesn't work. I'm a bit confused by the Unity documentation. please help me i'm newbie in Unity. my code : void Start () { if (myGuiTexture.HitTest(Input.GetTouch(0).position)) { if (Input.GetTouch(0).phase == TouchPhase.Began) { Time.timeScale = 1; myGuiTexture.enable = false; } } } and i also create this source but its doesn't work too. void Start () { if (tutorial.HitTest(new Vector3(0,0,0))){ Time.timeScale = 1; } }

    Read the article

  • I can't use my iPod touch (32GB)

    - by Silambarasan
    Hi All.. I have connected my ipod touch 32gb in my ubuntu 10.10 os.It's connected on os and shows in desktop. but it's not showing as a device in Rhythmbox music player. and also I can't open directly like folder or drive or usb device. when I try to open it show this Error: Could not display "gphoto2://[usb:001,003]/". Error: DBus error org.freedesktop.DBus.Error.ServiceUnknown: The name :1.207 was not provided by any .service files Please select another viewer and try again. Any solution for this problem?

    Read the article

  • Banshee can't see my 2G iPod Touch

    - by TheBlackParrot
    I have a jailbroken 8GB 2nd gen iPod Touch running iOS 4.2.1, and Banshee can't see it, I think. It spits out errors when I plug it in, but it never shows up. http://pastebin.com/HuFDXCmQ is what it's doing according to the terminal. Ubuntu can see it and I can access files fine with Nautilus and pantheon-files. Rhythmbox can see it, but is asking to initialize it. However it doesn't let me select a "Model" and it remains greyed out and blank. It never does seem to initialize it either. Running Ubuntu 12.04 and Banshee 2.6.0. EDIT: Discovered the library was actually corrupted, it's working fine now after a restore.

    Read the article

  • Drawing line from sprite with a touch

    - by Kaizer
    I am working with cocos2d for the iPhone and I have a question about how to implement the following. I have a circle shaped sprite on my layer. When I touch the sprite and move my finger a line must be drawn from the sprite to where my finger is. When I move my finger on the screen the line must follow (straight line). When I release my finger the line should disappear. In a good looking way I should be able to restyle the line into an arrow. Can anyone move me in the right direction for this ? Kind regards

    Read the article

  • Multiple touch problem using UITouch/UIView in iphone

    - by John Qualis
    Hi, I am trying to implement a 2-finger "pinch" and "expand" (or enlarge) on a UIView using iPhone 3G and SDK 3.1.2. I haven't done programmed in UITouch/UIEvent before, so I appreciate any guidance to the problem I am facing. When I touch the screen with 2 fingers I see that sometimes "touchesBegan" gives me only 1 event. I need UITouch event count == 2 to measure the distance between 2 fingers. Hence I have to lift up my fingers and repeat this process again till I get both fingers to be detected. Is there a way around? Can I improve it? The actual resize works correctly once both fingers are detected but this issue seen at the start needs to be resolved. I know SDK 3.2 detects gestures such as pinch but I was wondering how it can be done in 3.1.2? The code is given below. The "OnFingerDown" function gets called randomly even when I put 2 fingers down whereas I want "onTwoFingersDown" to be called each time. Moreover the I get only 1 touch event each time I put my fingers down. I mean if "OnFingerDown" was called twice I could somehow get it to work. Thanks in advance. Appreciate any help. John - (void) touchesBegan: (NSSet*) touches withEvent: (UIEvent*) event { UITouch* touch, *touch1; CGPoint location, location1; if([[event allTouches] count] == 1) { touch=[UI[[event allTouches] allObjects] objectAtIndex:0]; location=[touch locationInView:self]; OnFingerDown(location); } else if([[event allTouches] count] == 2) { touch=[[[event allTouches] allObjects] objectAtIndex:0]; location=[touch locationInView:self]; touch1=[[[event allTouches] allObjects] objectAtIndex:1]; location1=[touch1 locationInView:self]; OnTwoFingersDown(location, location1); } }

    Read the article

  • How to intercept touch events globally?

    - by mystify
    I have an view which is sometimes covered by some other views. However, if the user slides the finger across the screen, I want to slide that underlying view across the screen, too. I could start making custom views for all those covering subviews and forward all kinds of touch events, but that's somewhat cumbersome. Maybe there's some kind of notification or another way that a UIView or UIControl subclass can be aware of touch events happening right now, no matter where they are. In short: I need an UIView subclass or UIControl subclass which knows about any touch events happening on the entire screen. Or at least if tht's not possible, knowing about any touch events happening above itself in the same underlying superview. Another description: There are 20 views, all reside inside the same superview. The first view is covered by 19 others. But if the user slides across the screen, that first view must slide too, so it must be aware of touch events. Is there any better solution that making all 19 views forward touch events? (yes, all 19 views respond to touch events in this example)

    Read the article

  • Rotate triangle so that its tip points in the direction of the point on the screen that we last touched

    - by Sid
    OpenGL ES - Android. Hello all, I am unable to rotate the triangle accordingly in such a way that its tip always points to my finger. What i did : Constructed a triangle in by GL.GL_TRIANGLES. Added touch events to it. I can rotate the triangle along my Z-axis successfully. Even made the vector class for it. What i need : Each time when I touch the screen, I want to rotate the triangle to face the touch point. Need some help. Here's what i implemented. I wonder that where i am going wrong? My code : public class Graphic2DTriangle { private FloatBuffer vertexBuffer; private ByteBuffer indexBuffer; private float[] vertices = { -1.0f,-1.0f, 0.0f, 2.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f }; private byte[] indices = { 0, 1, 2 }; public Graphic2DTriangle() { ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4); vbb.order(ByteOrder.nativeOrder()); // Use native byte order vertexBuffer = vbb.asFloatBuffer(); // Convert byte buffer to float vertexBuffer.put(vertices); // Copy data into buffer vertexBuffer.position(0); // Rewind // Setup index-array buffer. Indices in byte. indexBuffer = ByteBuffer.allocateDirect(indices.length); indexBuffer.put(indices); indexBuffer.position(0); } public void draw(GL10 gl) { gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glDrawElements(GL10.GL_TRIANGLES, indices.length, GL10.GL_UNSIGNED_BYTE, indexBuffer); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); } } My SurfaceView class where i've done some Touch Events. public class BallThrowGLSurfaceView extends GLSurfaceView{ MySquareRender _renderObj; View _viewObj; float oldX,oldY,dX,dY; final float TOUCH_SCALE_FACTOR = 0.6f; Vector2 touchPos = new Vector2(); float angle=0; public BallThrowGLSurfaceView(Context context) { super(context); // TODO Auto-generated constructor stub _renderObj = new MySquareRender(context); this.setRenderer(_renderObj); this.setRenderMode(RENDERMODE_WHEN_DIRTY); } @Override public boolean onTouchEvent(MotionEvent event) { // TODO Auto-generated method stub touchPos.x = event.getX(); touchPos.y = event.getY(); Log.i("Co-ord", touchPos.x+"hh"+touchPos.y); switch(event.getAction()){ case MotionEvent.ACTION_MOVE : dX = touchPos.x - oldX; dY = touchPos.y - oldY; if(touchPos.y > getHeight()/2){ dX = dX*-1; } if(touchPos.x < getWidth()/2){ dY = dY*-1; } _renderObj.mAngle += (dX+dY) * TOUCH_SCALE_FACTOR; requestRender(); Log.i("AngleCo-ord", _renderObj.mAngle +"hh"); } oldX = touchPos.x; oldY = touchPos.y; Log.i("OldCo-ord", oldX+" hh "+oldY); return true; } } Last but not the least. My vector2 class. public class Vector2 { public static float TO_RADIANS = (1 / 180.0f) * (float) Math.PI; public static float TO_DEGREES = (1 / (float) Math.PI) * 180; public float x, y; public Vector2() { } public Vector2(float x, float y) { this.x = x; this.y = y; } public Vector2(Vector2 other) { this.x = other.x; this.y = other.y; } public Vector2 cpy() { return new Vector2(x, y); } public Vector2 set(float x, float y) { this.x = x; this.y = y; return this; } public Vector2 set(Vector2 other) { this.x = other.x; this.y = other.y; return this; } public Vector2 add(float x, float y) { this.x += x; this.y += y; return this; } public Vector2 add(Vector2 other) { this.x += other.x; this.y += other.y; return this; } public Vector2 sub(float x, float y) { this.x -= x; this.y -= y; return this; } public Vector2 sub(Vector2 other) { this.x -= other.x; this.y -= other.y; return this; } public Vector2 mul(float scalar) { this.x *= scalar; this.y *= scalar; return this; } public float len() { return FloatMath.sqrt(x * x + y * y); } public Vector2 nor() { float len = len(); if (len != 0) { this.x /= len; this.y /= len; } return this; } public float angle() { float angle = (float) Math.atan2(y, x) * TO_DEGREES; if (angle < 0) angle += 360; return angle; } public Vector2 rotate(float angle) { float rad = angle * TO_RADIANS; float cos = FloatMath.cos(rad); float sin = FloatMath.sin(rad); float newX = this.x * cos - this.y * sin; float newY = this.x * sin + this.y * cos; this.x = newX; this.y = newY; return this; } public float dist(Vector2 other) { float distX = this.x - other.x; float distY = this.y - other.y; return FloatMath.sqrt(distX * distX + distY * distY); } public float dist(float x, float y) { float distX = this.x - x; float distY = this.y - y; return FloatMath.sqrt(distX * distX + distY * distY); } public float distSquared(Vector2 other) { float distX = this.x - other.x; float distY = this.y - other.y; return distX * distX + distY * distY; } public float distSquared(float x, float y) { float distX = this.x - x; float distY = this.y - y; return distX * distX + distY * distY; } } PS : i am able to handle the touch events. I can rotate the triangle with the touch of my finger. But i want that ONE VERTEX of the triangle should point at my finger position respective of the position of my finger.

    Read the article

  • Odd values/movement with UITouch and CGPoint.

    - by Joshua
    I'm getting odd numbers from UITouch and CGPoint and one is different, I also think this maybe causing a flickering affect in my app when I try to move something by following a touch. This is the code I'm using: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"touchDown"); UITouch *touch = [touches anyObject]; firstTouch = [touch locationInView:self.view]; if (CGRectContainsPoint(but.frame, firstTouch)) { butContains = YES; NSLog(@"butContains = %d", butContains); } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; currentTouch = [touch locationInView:self.view]; NSInteger x = currentTouch.x; NSInteger y = currentTouch.y; CGFloat CGX = (CGFloat)x; CGFloat CGY = (CGFloat)y; if (butContains == YES) { NSLog(@"touch in subView/contentView"); sub.frame = CGRectMake(CGX, CGY, 130.0, 21.0); } NSLog(@"touch moved"); } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; currentTouch = [touch locationInView:self.view]; NSLog(@"User tapped at %@", NSStringFromCGPoint(currentTouch)); NSLog(@"Point %a, %a", currentTouch.x, currentTouch.y); NSInteger x = currentTouch.x; NSInteger y = currentTouch.y; NSLog(@"Point %a, %a", y, x); CGFloat CGX = (CGFloat)x; CGFloat CGY = (CGFloat)y; NSLog(@"Point %g, %g", CGX, CGY); if (butContains == YES) { NSLog(@"touch in subView/contentView"); sub.frame = CGRectMake(CGX, CGY, 130.0, 21.0); } butContains = NO; NSLog(@"touch ended"); } - (IBAction)add:(id)sender{ InSightViewController *contentView = [[InSightViewController alloc] initWithNibName:@"SubView" bundle:[NSBundle mainBundle]]; [contentView loadView]; [self.view insertSubview:contentView.view atIndex:0]; } This is what I get from the touchesEnded method in the Debugger. 2010-04-20 20:06:13.045 InSight[25042:207] User tapped at {50, 78} 2010-04-20 20:06:13.047 InSight[25042:207] Point 0x1.9p+5, 0x1.38p+6 2010-04-20 20:06:13.048 InSight[25042:207] Point 0x1.900000027p-1037, 0x1.38p+6 2010-04-20 20:06:13.048 InSight[25042:207] Point 50, 78 And this is what's happening in the Simulator. fwdr.org/file:y8bd As this is a complicated problem this is the source code of my XCode Project aswell. http://cl.ly/Qjj

    Read the article

  • How to Never Use iTunes With Your iPhone, iPad, or iPod Touch

    - by Chris Hoffman
    iTunes isn’t an amazing program on Windows. There was a time when Apple device users had to plug their devices into their PCs or Macs and use iTunes for device activation, updates, and syncing, but iTunes is no longer necessary. Apple still allows you to use iTunes for these things, but you don’t have to. Your iOS device can function independently from iTunes, so you should never be forced to plug it into a PC or Mac. Device Activation When the iPad first came out, it was touted as a device that could replace full PCs and Macs for people who only needed to perform light computing tasks. Yet, to set up a new iPad, users had to plug it into a PC or Mac running iTunes and use iTunes to activate the device. This is no longer necessary. With new iPads, iPhones, and iPod Touches, you can simply go through the setup process after turning on your new device without ever having to plug it into iTunes. Just connect to a Wi-Fi or cellular data network and log in with your Apple ID when prompted. You’ll still see an option that allows you to activate the device via iTunes, but this should only be necessary if you don’t have a wireless Internet connection available for your device. Operating System Updates You no longer have to use Apple’s iTunes software to update to a new version of Apple’s iOS operating system, either. Just open the Settings app on your device, select the General category, and tap Software Update. You’ll be able to update right from your device without ever opening iTunes. Purchased iTunes Media Apple allows you to easily access content you’ve purchased from the iTunes Store on any device. You don’t have to connect your device to your computer and sync via iTunes. For example, you can purchase a movie from the iTunes Store. Then, without any syncing, you can open the iTunes Store app on any of your iOS devices, tap the Purchased section, and see stuff you’ve downloaded. You can download the content right from the store to your device. This also works for apps — apps you purchase from the App Store can be accessed in the Purchased section on the App Store on your device later. You don’t have to sync apps from iTunes to your device, although iTunes still allows you to. You can even set up automatic downloads from the iTunes & App Store settings screen. This would allow you to purchase content on one device and have it automatically download to your other devices without any hassle. Music Apple allows you to re-download purchased music from the iTunes Store in the same way. However, there’s a good chance you have your own music you didn’t purchase from iTunes. Maybe you spent time ripping it all from your old CDs and you’ve been syncing it to your devices via iTunes ever since. Apple’s solution for this is named iTunes Match. This feature isn’t free, but it’s not a bad deal at all. For $25 per year, Apple allows you to upload all your music to your iCloud account. You can then access all your music from any iPhone, IPad, or iPod Touch. You can stream all your music — perfect if you have a huge library and little storage on your device — and choose which songs you want to download to your device for offline use. When you add additional music to your computer, iTunes will notice it and upload it using iTunes Match, making it available for streaming and downloading directly from your iOS devices without any syncing. This feature is named iTunes Match because it doesn’t just upload music — if Apple already has a song you upload, it will “match” your song with Apple’s copy. This means you may get higher-quality versions of your songs if you ripped them from CD at a lower bitrate. Podcasts You don’t have to use iTunes to subscribe to podcasts and sync them to your devices. Even if you have a lowly iPod Touch, you can install APple’s Podcasts app from the app store. Use it to subscribe to podcasts and configure them to automatically download directly to your device. You can use other podcast apps for this, too. Backups You can continue backing up your device’s data through iTunes, generating local backups that are stored on your computer. However, new iOS devices are configured to automatically back up their data to iCloud. This happens automatically in the background without you even having to think about it, and you can restore such backups when setting up a device simply by logging in with your Apple ID. Personal Data In the days of PalmPilots, people would use desktop programs like iTunes to sync their email, contacts, and calendar events with their mobile devices. You probably shouldn’t have to sync this data form your computer. Just sign into your email account — for example, a Gmail account — on your device and iOS will automatically pull your email, contacts, and calendar events from your associated account. Photos Rather than connecting your iOS device to your computer and syncing photos from it, you can use an app that automatically uploads your photos to a web service. Dropbox, Google+, and even Flickr all have this feature in their apps. You’ll be able to access your photos from any computer and have a backup copy without any syncing required. You may still need to use iTunes if you want to sync local music without paying for iTunes Match or copy local video files to your device. Copying large local files over is the only real scenario where you’d need iTunes. If you don’t need to copy such files over, you can go ahead and uninstall iTunes from your Windows PC if you like. You shouldn’t need it.     

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >