|
In Cocos2D, I seem to have an issue with setting a sprites visibility to YES and NOT seeing the results immediately after a method call that hangs everything for a bit. It seems as though a frame draw has to occur, but this doesn't happen because the method call stops everything for a bit which makes it very noticeable. (There is no sprite in sight even though there should be) Does anyone know how to force a frame draw in Cocos2D? I think this my problem. Calling update (my CCScheduler method) would probably just cause an infinite loop, and maybe there's some way I could circumvent this, but it's just going to get messy. I've also tried making the visibility YES right before the method is called, but that does not make it show up either. LP0 ON FIRE fucked around with this message at 22:37 on Dec 2, 2011 |
# ¿ Dec 2, 2011 22:24 |
|
|
# ¿ May 16, 2024 15:46 |
|
When I switch tabs in Xcode, sometimes it's scrolled to totally the wrong position. I have to go up to the method selection and select it. Does anyone know what's going on here? Am I doing something wrong, or is it just a bug?
|
# ¿ Jan 10, 2012 19:17 |
|
I'm reposting a question asked on the Cocos2D forum, since it is quite a complicated issue and there are more posters here. I have a sprite added from a method call in init using convertToNodeSpace, and it is placing it incorrectly. I use practically use the same code elsewhere to place sprites with convertToNodeSpace (placing it in the center of the iPad screen) and it works fine. My guess is before init returns self, convertToNodeSpace cannot make an accurate conversion. Is this the problem most likely, and is there any known solutions?
|
# ¿ Jan 20, 2012 18:34 |
|
Carthag posted:So it looks like at different points in the sprite's lifetime, convertToNodeSpace behaves differently? I haven't used cocos2d, but have you tested this (in the same object)? Like putting the conversion later on, and seeing if it gives a different result than during init? Exactly. It gives a different result if I use convertToNodeSpace later on and outside of init. I heard that it's a problem that I'm calling it on a node that does not yet have a parent. There has to be an alternate way of getting the center coordinates of the iPad/iPhone screen area (not the entire current map) and placing the sprite there. edit: Fixed it! I have my method call to place this sprite right before return self in init. Somehow that works. LP0 ON FIRE fucked around with this message at 20:14 on Jan 20, 2012 |
# ¿ Jan 20, 2012 19:28 |
|
For the most part I'm used to writing applications for iOS, but I just started experimenting making stuff for OS X. I'm trying to make a simple video player and followed this tutorial with slightly different names for files. I try opening a MOV file from my application I built, and nothing happens. I can't figure out what's wrong. For anyone that wants to help and check out my project, It's very cut and dry, so someone that's knowledgeable with this stuff I'm sure can easily track it down. In my console, before I even open anything I receive the waring several times "Unable to read symbols for cl_kernels (file not found)."
|
# ¿ Jan 22, 2012 21:51 |
|
Thanks Doc Block! I started off the wrong kind of project with just a delegate, so everything became kind of twisted when I followed this tutorial. I should have started from scratch, but I also wanted to learn what was wrong since most of the experience I have is without using interface builder. I'm deciding to learn not to hate it and give it a try.
|
# ¿ Jan 23, 2012 03:58 |
|
duck monster posted:gently caress coder machismo. Interface builder is awesome, once you get the hang of it. I bet it is, but it's sort of over my head to make a ton of crazy connections to buttons that have tweened animation, may or may not be displaying, and sliding transitions into other views, etc, which is exactly what I needed to create for my first app. It was enough pressure that I was just learning Obj-C, and then decided whether or not it was really worth creating a nib for something like a movie player, which would just be a feature that would be recycled throughout the program with different filenames. I can see where it would be really beneficial, like if you had a lot of carefully placed sliders, and it would be much easier to draw those out on a space. But usually I'm going from something like a design from Photoshop and getting button coordinates and then just hardcoding them. It's not that I really like coding interfaces, but sometimes factoring in IB seems like unnecessary extra work.
|
# ¿ Jan 23, 2012 04:33 |
|
duck monster posted:The whole deal with iOS and mac interfaces is they should be simple and as apple-y looking as possible. IF its compliant, your coding in a propper model-view-controller pardgim and are not rolling whats already provided, then chances are your IB <-> Code relationship will be simple. I wish I could have made it Apple-y looking, but it wouldn't have lived up to the expectations of the client. Other than that, it still followed the model-view-controller guidelines. And for the past 11 months I've been working on a game in Cocos2D, so I STILL haven't had any experience really using interface builder! Just now I'm trying to get my feet wet in IB with some personal projects. Doc Block posted:And with IB you also have the added advantage of immediate feedback if you want to tweak an element's attributes or placement. I agree, and it will probably help out a lot with what I'm making now.
|
# ¿ Jan 23, 2012 15:07 |
|
Is it safe to call just [self methodName:] on a method that has only a BOOL parameter? I'm using it on a selector in Cocos2D like this: id actionRestoreEnergy = [CCCallFuncN actionWithTarget:self selector:@selector(restoreHeroEnergy:)]; The only reason I want to do it this way is because that selector doesn't need to send a YES message in that particular instance, and I don't feel like doing all the data stuff and changing my method because it seems like it does the same thing as long as it's not causing leaks to memory and such. edit: Actually this is bad because it is always returning YES with just restoreHeroEnergy: LP0 ON FIRE fucked around with this message at 19:25 on Feb 3, 2012 |
# ¿ Feb 3, 2012 19:18 |
|
Gordon Cole posted:If the value of the argument doesn't matter, why not just pass in an arbitrary value instead of not passing anything and hoping it works? If you want to make it clear that the parameter doesn't matter in this case, make another method called restoreHeroEnergy that doesn't take any argument and just calls the actual method with a default value. In my case I'm using selector, and if I did want to send any kind of message it would look something like this: [CCCallFuncND actionWithTarget:self selector:@selector(restoreHeroEnergy : data:) data:[[NSNumber numberWithBool:NO] retain]]; And then I'd need to edit the restoreHeroEnergy method and also take into account to release that NSNumber. I guess not such a big deal but why make things look more messy if restoreHeroEnergy in that selector.. but I now know that's not the case. LP0 ON FIRE fucked around with this message at 20:52 on Feb 3, 2012 |
# ¿ Feb 3, 2012 20:33 |
|
Gordon Cole posted:I've never used Cocos2D so I'm probably missing something here, but what's the purpose of calling the method that way rather than doing [self restoreHeroEnergy: NO]? Good question. I should have cleared that up first. CCCallFuncN can be used on an action definition to be run in a certain sequence with the runAction method. Actions can be used on sprites to move to a certain location, fade out, etc, and then a function action can be run anytime in that sequence to call methods. CCCallFuncN doesn't support just passing any type of parameter, so you need to set it in node data.
|
# ¿ Feb 3, 2012 22:08 |
|
Since my entire scene in cocos2D gets replaced during transitions when I still need a text layer to stay unaltered, I needed to abandon cocos2D sprite text for that layer. I added a UIView in front tested the replacement with a UILabel, and everything is running smoothly. But this a UILabel...not outlined sprite text. Does anyone know of some handy code or framework that would work as a good sprite text replacement that can be shown in a UIView?
|
# ¿ Feb 8, 2012 22:46 |
|
With lots of trial and error, I ended up making my own method to stroke text with some amazing results. I expected this to run slowly because it sometimes renders text with a stroke as a UIImage many times per second.code:
code:
|
# ¿ Feb 9, 2012 23:32 |
|
Thanks Doc Block. I didn't realize I could just keep using that same UIImageView. I'll try that out tomorrow. Also it does only create a new image only if tetraCount changes, and not every frame.
|
# ¿ Feb 10, 2012 07:00 |
|
I need a good tool to create "virtual tour" 360° view panoramas, complete with hotspots to go to a new location or view a photo for iOS only. I found a couple that blew me away with their demos, but after downloading the trial versions I wasn't so pleased: KRPano - The tools are just droplets that you can drag and drop images to. No tool that has a UI that I can see, which would actually make things like placing hotspots do-able. Easypano - Pano tool crashes 4/5 times that I attempt to publish. Don't see any way to place hotspots, but maybe I downloaded the wrong version. Any suggestions? LP0 ON FIRE fucked around with this message at 20:19 on Feb 24, 2012 |
# ¿ Feb 24, 2012 19:53 |
|
Sorry I forgot to mention I need something for iOS. Photosynth is cool, but I thought it was limited to being made up of a bunch of pictures you take with your phone. I need a tool where you can import an entire panorama and view it and create hotspots for navigation, etc. edit: Panotour Pro seems pretty amazing to work with, but I can't test for iOS unless I buy the full version. LP0 ON FIRE fucked around with this message at 21:22 on Feb 24, 2012 |
# ¿ Feb 24, 2012 20:22 |
|
I'm in one of these moments where I'm doing something completely retarded but I'm absolutely stumped. I'm just trying to load my html into my UIWebView with the correct baseURL so that I can use relative paths.code:
|
# ¿ Feb 29, 2012 18:23 |
|
pokeyman posted:
Carthag posted:You're having the webView show the actual HTML string "tour.html", not the file by that name. It's for doing things like loadHTMLString:@"<html>blahblah</html>" Thank you. I ended up going with [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"tour" ofType:@"html"]isDirectory:NO]]]; And then I had many hardships with adding folders the correct way and trying to figure out why my javascript wouldn't work in my UIWebView. I hope someone reading this will save themselves some time in case they don't know: 1.) When dragging folders in that you want a UIWebView to reference as offline data, make sure you click the "Create folder references for any added folders" radio button. 2.) Any javascript files on the root level of resources (not in a folder) will be compiled by Xcode. In most cases you don't want this to happen if the UIWebView depends on using it just as a website would. You need to drag the javascript files from your Compile Sources in Build Phases into Copy Bundle Resources. Now everything works great!
|
# ¿ Mar 1, 2012 01:53 |
|
Doc Block posted:If you don't need JavaScipt or anything really complex but just want the ability to show formatted text with images and links, and still be able to have it fit the look of your app then give DTCoreText a shot. Cool, good to note. I'm actually using KRPano made from Panotour Pro to view virtual tours. The challenge was doing this offline with UIWebView so that I can include it in an app that can do other things than just view the virtual tours. Other people are using GoodReader, which is lame to me because that means I can't use my virtual tours in an app that runs offline.
|
# ¿ Mar 1, 2012 04:23 |
|
I have an enterprise provision mess on my shoulders right now. The company that I made an enterprise iPad app for did not renew their provision nor their account. As soon as they paid for a new yearly fee, I had access to their account but the provision was expired. There was no renew button, and the distribution certificate was gone from the portal. So I removed the provision, and made one with the same name and another certificate that associated with that provision, downloaded those both and synced with my iPad. And of course, the app does not launch, and why would I expect it to since the app is associated with the old provision.. So the disaster here is that there's around 100 iPads around the world with this app on it. Do I really need to rebuild the app with the new certificate and it pointing to the correct provision in the build settings? If that's true I'll have to redistribute it. I'd rather just send everyone a new provision. Another thing is that I thought this provision was never supposed to expire. It's not an Ad Hoc but an In House provision. Restarted organizer and that issue cleared up. But I still can't figure out a way to make this work without making a new build. Enterprise distribution has been a nightmare to me. Ultimately, if none of this works without making a new build, I'd like to know a way of distributing enterprise apps without having poo poo expire. LP0 ON FIRE fucked around with this message at 19:15 on Mar 13, 2012 |
# ¿ Mar 13, 2012 18:05 |
|
drat... I just upgraded my work's iPad to iOS 5.1, and it seems that I can no longer test on this device unless I upgrade to Lion to install the new Xcode. I get this when I try to run: Am I right about that?
|
# ¿ Mar 13, 2012 22:42 |
|
duck monster posted:Set up hockeykit on a server somewhere and do that. Its a pain in the arse, but its a tonne easier than trying to coordinate 100+ dumb arses to correctly set up their devices. plus the auto over-the-air updates solves it for future instances too. Ugh.. yeah the problem with this or any solution like downloading is that the app is about 2 GB. In some places internet connection is really poor so this just wouldn't be satisfactory. We tested it and the app downloading and installing can take a half a day or more in some places. Hog Obituary posted:You need Xcode 4.3.1 to develop/debug with iOS 5.1, yes. That sucks I guess I will have to convince them to upgrade my computer even though it is very cheap. It's just that a lot of software we run is not compatible with Lion. I was pointed to some other solutions on Stack Overflow, but they are very hacky look like a pain to incorporate. May as well upgrade my OS X. LP0 ON FIRE fucked around with this message at 01:50 on Mar 14, 2012 |
# ¿ Mar 14, 2012 01:48 |
|
duck monster posted:how the gently caress did you make a 2Gb app? The bulk of it consists of high quality videos that can also be displayed on a TV when the iPad is connected to it, so they have to look good scaled up. The videos are still pretty well compressed, there's just a lot of them. Yeah, so I'm just going to have to remember for next time that when I update my iOS, I may also have to update my OS X so I can install a new Xcode! Although this happens so far apart though I know I'll forget..
|
# ¿ Mar 14, 2012 05:43 |
|
I know this might sound sort of arbitrary, but I thought my Cocos2D game with the 3rd generation iPad would take advantage of it's faster processor and give me a higher fps. It was running really well on the iPad 2 so I thought it would be pegging at 60fps all the time, but it seems to running the same as it was before. Are there any extra build settings I should change?
|
# ¿ Mar 16, 2012 20:13 |
|
Doc Block posted:It depends on what your game is doing, and how well optimized it is. If you have lots of overdraw then you're going to be fillrate limited, and with 4 times as many pixels to draw, things aren't going to be magically fixed. Hmm.. I think I understand. So by theory if my code is optimized and I'm not doing anything overzealous, my game should run about the same with retina graphics. I've been running v0.99.5, and I don't feel so comfortable upgrading since I've edited the framework so much.
|
# ¿ Mar 16, 2012 21:52 |
|
I keep on getting pngcrush errors in Xcode (app builds anyway) from png images I saved for web and devices from Photoshop. They are transparent and NOT interlaced. I re-saved as png's in preview like the threads on StackOverflow suggested to no avail. Even though my app builds, it's only every so often that the build displays the images correctly. edit: I had the same files in another directory in resources.. That'll do it. LP0 ON FIRE fucked around with this message at 20:25 on Mar 30, 2012 |
# ¿ Mar 30, 2012 19:56 |
|
Cocos2D iOS: I'm having trouble accessing a parent method from a sprite class. A bunch of the sprite classes are put into a mutable array in the parent class. When a method is called in the child class a sort of timed call to the parent is called later on using CCCallFuncO. But even with a regular method call in the child class to parent won't work! In the child's .h I have code:
code:
LP0 ON FIRE fucked around with this message at 17:30 on Apr 17, 2012 |
# ¿ Apr 17, 2012 17:25 |
|
pokeyman posted:Stick a breakpoint on the line where you send -displayMessageBox: and check things out. Is joinedMapsLayer right object (i.e. not nil, right type)? Step into the method call. Does it go where you want? I'm not sure where I would find if joinedMapsLayer is nil or not. I made a new method in joinedMapsLayer called test with no parameters and a NSLog inside. When I step into the the line [joinedMapsLayer test]; which is inside the child sprite class I get code:
e: Doc Block posted:Check and see if self.parent is nil. If you're adding the child sprites to the array yourself, rather than using CCNode's addChild: method, then you'll have to set the child sprite's parent property yourself. Wait, this is interesting.
|
# ¿ Apr 17, 2012 17:53 |
|
pokeyman posted:At the lldb prompt type po joinedMapsLayer (CCNode *(*)(void)) $1 = 0x00041475 (Flying Adventure`-[JoinedMapsScene joinedMapsLayer] + 1 at JoinedMapsScene.m:15) [no Objective-C description available] By the way Doc Block, I'm trying to look it up, but I don't know how to manually set a child sprite's parent property as of yet. I'm guessing it's really easy. I also need to make sure that this is the problem first.
|
# ¿ Apr 17, 2012 18:00 |
|
Holy crap you guys are amazing. It would have taken me ages to figure this out by myself. In init, when I when I make a temporary pointer to an array index I just do: tempHummingChar.parent = self; Now it works!
|
# ¿ Apr 17, 2012 18:08 |
|
Doc Block posted:Not to be a jerk, but if the parent property wasn't set somewhere then yeah, it isn't going to work. Thanks for the info. Most of the sprites I add into arrays have a whole class included so I can edit my own custom properties. So after I make a temporary pointer off the array index I can just do tempClass.health -= 5 or access the sprite directly like tempClass.sprite.opacity = 25.
|
# ¿ Apr 18, 2012 13:34 |
|
A couple hours ago I asked about this on StackOverflow and the Cocos2D forum, and although that's a small amount of time to get an answer, I'm eager to hear someones insight into a common problem I have. What I have is a sprite and sprite sheet that I made properties for in a CCLayer class (JoinedMapsLayer) where my update and draw methods are. I can call a method that actually adds the sprite sheet to the layer, but I found using an instance method and class method does not work properly. Even though I point to self(JoinedMapsLayer) in my class method, it does not add the sprite sheet to it. I checked the parent object on the sprite sheet after the method is called, and it is nil. Way more details on my StackOverflow thread: http://stackoverflow.com/questions/10319666/cocos2d-cant-seem-to-create-child-sprites-correctly-using-class-or-instance-me I was stuck on a similar problem all day yesterday that I called quits on for now, but since this method is simpler, I thought I'd have an easier time explaining it thoroughly, including all the details to make more apparent what I'm doing wrong.
|
# ¿ Apr 25, 2012 20:01 |
|
Froist posted:LP0: I'm not all that experienced in ObjC but I can't see any reason why your code isn't working I'm afraid. Like you, I'd expect that to work fine. Well dang, it really feels like I've run out of ideas here. I've tried it with two different methods, and both as instance and class methods. Maybe there's something else I have in my code that's causing it but I don't know what it is.
|
# ¿ Apr 25, 2012 21:44 |
|
Carthag posted:Oh I get it now. LP0, put a breakpoint at the beginning of your class method and try doing po layer when it throws up the debugger. If it isn't what is expected, go to the previous method in the stacktrace in the navigator in the left side of the window, and see where it's being called from. I think it's what is expected: (CCLayer *) $0 = 0x004af300 <JoinedMapsLayer = 004AF300 | Tag = -1>
|
# ¿ Apr 25, 2012 22:25 |
|
Carthag posted:Try with a breakpoint right after [layer addChild:spriteSheet z:13]; maybe and seeing what the parent is then? You can do that with po [spriteSheet parent]. Basically if that is correct, step through the code and do the po again and see when it goes away. With po [spriteSheet parent] right after [layer addChild:spriteSheet z:13]; I get (CCNode *) $0 = 0x00000000 <nil>.
|
# ¿ Apr 25, 2012 23:40 |
|
Carthag posted:What the gently caress. I don't think I overrid any of the CCNode inherited methods. Does the thing in bold have to do with what you just said about addChild and setting the parent? http://forums.somethingawful.com/showthread.php?threadid=3400187&userid=0&perpage=40&pagenumber=54#post402701244 I know it may not directly relate, but because I'm using a class method the parent doesn't get set?
|
# ¿ Apr 26, 2012 00:42 |
|
Doc Block, and everyone else, thanks very much for helping. Doc Block - I'm trying to assign the position, scale and opacity properties like you have in the code you provided, but it is giving me "Member reference base type 'CCSprite **' is not a structure or union" errors. I tried playing around with it a bit with no success and trying to understand this pointer-to-pointer stuff since I've never done it much before. Also sorry about the NSString nonsense. That was just copied and pasted over from something that conditionally had different strings added to the file names. Edit: I think I've got it. I need to put parentheses around *sprite and access the property like this: (*sprite).opacity = 0; But I don't know why Edit 2: A confirmation that it works! I'll need to study this approach a whole bunch to understand it. I'm a little slow at this stuff, and I don't think I have the mind for it, but I've been learning SLOWLY. (Also I'm not a computer science major) So, thanks again everyone. Maybe I'll understand why I should use an instance over a class method. The reason the way I should take the class method approach is because I don't want to clutter up my class making the calls with alloc and release lines, but maybe that's not a good reason. LP0 ON FIRE fucked around with this message at 19:00 on Apr 26, 2012 |
# ¿ Apr 26, 2012 16:58 |
|
Bob Morales posted:Was the iOS team forced to just pick one file system or something? Why would they pick case-insensitive and cause pain for developers? I have no idea. It's caused me to waste a lot of time too. There's a good answer here of how to turn case-sensitivity on for iOS: http://stackoverflow.com/questions/5908931/make-iphone-simulator-case-sensitive-on-file-access
|
# ¿ Apr 27, 2012 18:48 |
|
Some aspects of my game have been changed back and forth a few times, and now I'm revisiting a problem I'm having with making the background in open gl transparent using Cocos2D that I had three months ago. This is sort of a repost from the Cocos2D forum: 1.) I have an overlay sprite that gets added to my CCLayer at times and it's opacity is adjusted to 200 with an action. An image thats added to my UIView then shows through everything once the opacity changes when normally it's behind everything. It's as if my whole TMX tile map (or everything in openGL for that matter) has it's opacity adjusted too. This never started happening until I implemented the non-opaque background. 2.) When I hit the sleep button my iPad while the game is running, and then I turn it on again my game is running really slow until the scene is replaced. In my delegate, if I change pixel format setting from kEAGLColorFormatRGBA8 to kEAGLColorFormatRGB565, this problem no longer occurs: code:
But I need the transparency.. LP0 ON FIRE fucked around with this message at 20:28 on May 18, 2012 |
# ¿ May 18, 2012 20:14 |
|
|
# ¿ May 16, 2024 15:46 |
|
Doc Block posted:If memory serves, ARC is only supported on iOS 4.3 and up, not 4.2. Yes, I'm only changing the sprite's transparency. The overly sprite is a tiny sprite that get's scaled to the screens size so a half-transparent texture is put over everything except for a few buttons so everything else appears darker. Doc Block posted:If memory serves, you're using a really old version of Cocos2D, right? Which means you probably started from the really old Cocos2D project template, right? Maybe the old template didn't have any of the multitasking methods in the app delegate. All I'm doing differently is changing the pixel format to kEAGLColorFormatRGBA8. When I change it back to kEAGLColorFormatRGB565, the problem no longer occurs. Doc Block posted:This is because RGBA8 means your OpenGL ES framebuffer is 32-bit RGBA, meaning it supports the framebuffer itself being transparent. You'll note that the RGB565 pixel format has no mention of an alpha channel, hence you cannot get a transparent framebuffer when the pixel format is RGB565. What I'm trying to show through is showing through fine. It sounds strange, but it's my own custom parallax background class made outside of Cococs2D. The reason I felt like I needed this is because I wanted preserve the parallax while Cocos2D does scene transitions which slides the last scene off the screen while a new one is dragged on. Using the Cocos2D parallax background I couldn't achieve this correctly because the new parallax background would be overlapping the old one. I tried syncing them, but it just became a mess. Performance is great with my new parallax class, and the frame rate in Cocos2D isn't hindered at all. I also have my own gradient background behind that which I can do a lot more with than the Cocos2D. But anyway, still having problems. By the way, I'm using Cocos2D 0.99.5.
|
# ¿ May 21, 2012 14:07 |