|
This might be better suited for the screenshot thread, but I stayed up last night working on something for the first time in a long time. I wrote my first custom view, tabs! I need to add maximum tab sizes so if you have only 1 or 2 tabs they don't fill the size of the view, but there's a close button and it even highlights when you hover over it.
|
# ? Dec 12, 2011 02:27 |
|
|
# ? May 16, 2024 09:05 |
|
Good news everyone, TextMate 2 alpha is out tomorrow!
|
# ? Dec 12, 2011 22:59 |
|
Godspeed You! Black Conservative posted:Good news everyone, TextMate 2 alpha is out tomorrow! Where did you hear about that? I don't see anything on the Macromates blog or twitter.
|
# ? Dec 12, 2011 23:18 |
|
quote:**PLEASE DO NOT REPUBLISH THIS INFORMATION!**
|
# ? Dec 13, 2011 00:46 |
|
Awesome! And thanks for totally ignoring that request.
|
# ? Dec 13, 2011 00:55 |
|
pokeyman posted:Awesome! this is all over twitter, even apple devs are reposting this
|
# ? Dec 13, 2011 00:58 |
|
Quick question. I'm making a class for a deck of playing cards. This is in the deck init/shuffle method:code:
|
# ? Dec 13, 2011 21:03 |
|
Malloreon posted:Quick question. I'm making a class for a deck of playing cards. This is in the deck init/shuffle method: Did you initialize your deck array?
|
# ? Dec 13, 2011 21:12 |
|
OHIO posted:Did you initialize your deck array? Oh man, I totally did, but thanks to your comment I realized I initialized it just after I called the shuffle method. Boneheaded move of the day, thanks!
|
# ? Dec 13, 2011 21:15 |
|
So back to my cocos2D image distorting situation. This: code:
I'm definitely doing something wrong with the texture coordinates, probably because I am clueless with openGL stuff. Any suggestions?
|
# ? Dec 14, 2011 02:21 |
|
Maybe it's just me, but that triangle order seems wrong. edit: how are you actually drawing them? Doc Block fucked around with this message at 03:36 on Dec 14, 2011 |
# ? Dec 14, 2011 03:30 |
|
What does your draw call look like? Your first 3 points are a straight line, not a triangle.
|
# ? Dec 14, 2011 03:37 |
|
Here's the openGL stuff in the draw call:code:
|
# ? Dec 14, 2011 04:28 |
|
nolen posted:
The 'GL_TRIANGLES' is the primitive you're drawing. Here's info on how you're supposed to specify different primitives.
|
# ? Dec 14, 2011 05:16 |
|
You can't hand OpenGL an unordered list of vertexes, because it will try to draw them in the order they're in the array. So because your vertex array is specifying all the vertexes down the left and then all the vertexes down the right, you're getting funky results. Change it so that they go polygon-by-polygon (and change your texture coordinate order to match). Also, keep in mind that clockwise/counter-clockwise matters. Generally speaking, you want the order to be counter-clockwise, as this lets OpenGL determine which side of the polygon is the front and which side is the back, so that it can do backface culling. With a triangle strip like what you seem to be trying to draw, the vertex order should be something like in this pic: Disclaimer: I haven't done any OpenGL programming in a long time and the exact order in that pic could be wrong, but you get the idea. Just make sure your texture coordinates match your vertex order. edit: For now, just use triangles instead of triangle strips (I'd forgotten that, with triangle strips, every other triangle will be reversed because of the order of the vertexes). For 4 triangles you should have a vertex array of 12 vertexes, 3 for each triangle. With so few polygons, don't worry about the fact that some vertexes will be specified more than once, either. Doc Block fucked around with this message at 05:56 on Dec 14, 2011 |
# ? Dec 14, 2011 05:34 |
|
Just wanted to chime in and say thanks for all the help guys. I'll post back with my results tonight after fiddling with all the info you gave me.
|
# ? Dec 14, 2011 16:44 |
|
Ok, now that I have more time to program, I put together a good test storyboard just to play with the UI builder for iOS apps. However, I realized that it hadn't created header/m files to go along with each, something I guess I took for granted after seeing the first two appear when I created the new project. After reading around (Specifically about View Programming and http://developer.apple.com/library/...07457-CH101-SW1), I'm still not entirely sure what I need to do to properly set up a new Objective-C file that represents one of the many View Controllers. (I might be wrong on this, but: ) I realize that the controllers by default "run off" of/are header files in the UIKit framework, so I'll have to extend and override these with my own files, but I'm not exactly sure how to "pick" and/or "link" a certain header to a certain ViewController, if that makes sense... Any advice/explanation you guys can give me, or links to read?
|
# ? Dec 14, 2011 18:21 |
|
You're right about subclassing UIViewController (so you'll have MyViewController.h and MyViewController.m). Then in the storyboard, select the view controller, then show the Identity Inspector (View menu > Utilities > Show Identity Inspector), then put in your class name (MyViewController) where it says "Class", under "Custom Class".
|
# ? Dec 14, 2011 19:47 |
|
Perfect, thanks. I figured it was in someplace simple but I just couldn't find it.
|
# ? Dec 14, 2011 20:44 |
|
Don't forget to press Enter after you type it in, or it won't take.
|
# ? Dec 14, 2011 21:51 |
|
^^^ Hah, got it. Alright, here's another question: I need to have a static class accessible from any View Controller. Considering I'm fairly new to Objective-C programming practices I want to ask what the best way is to handle this. Currently I'm considering taking the approach from here which is basically: code:
Edit: pokeyman posted:I'd start with Mike Ash's Care and Feeding of Singletons. I suggest the GCD-based approach. dereekb fucked around with this message at 06:45 on Dec 15, 2011 |
# ? Dec 14, 2011 22:42 |
|
I'd start with Mike Ash's Care and Feeding of Singletons. I suggest the GCD-based approach.
|
# ? Dec 14, 2011 23:59 |
|
Speaking of storyboards, what's everyone's take? Worth the effort? Glad you started using them? The backstory is that I just started writing a large-ish update to our app, and I'm considering a switch to ARC as part of it. I thought I might check out storyboards as well. I need to get a rough version done in about two weeks, though, so not much time to spend on learning new things. take boat fucked around with this message at 07:23 on Dec 15, 2011 |
# ? Dec 15, 2011 07:03 |
|
They seem a pretty handy tool for prototyping. Don't really have an opinion either way about suitability for real-world use , since manually managing views is pretty innexpensive brainpower wise. If it makes your life easier, and you understand what its doing, sure, why not.
|
# ? Dec 15, 2011 07:14 |
|
I can't really see much of a benefit to migrating an existing app to storyboards. I guess you could give it a shot if you have some spare time? ARC, on the other hand, definitely has its benefits for both existing and new apps, so I'd hit that up. The two are completely orthogonal, so there's no need to do them both at once.
|
# ? Dec 15, 2011 07:28 |
|
pokeyman posted:I can't really see much of a benefit to migrating an existing app to storyboards. I guess you could give it a shot if you have some spare time?
|
# ? Dec 15, 2011 07:37 |
|
I hadn't even considered a half storyboard, half manual segue app. Might be a decent way to try out storyboards without having to rewrite your app if you change your mind. Might also be confusing as hell as you switch between the two halves.
|
# ? Dec 15, 2011 17:02 |
|
Welp. Holy poo poo. It's done. I just finished my iPad app TC-11, a fully programable multi-touch synthesizer. It has been a monster - but it's out there now. Tomorrow I'm going to make a Musician's Lounge thread about it, post it in the YouTube thread, but first... Seriouspost for a minute: you guys are the best little programming community. I'm not making GBS threads you when I say this app wouldn't have happened without you guys. Grab some promo codes below, enjoy, and thanks. https://vimeo.com/33756537 More info: http://www.bitshapesoftware.com/instruments/tc-11/ lord funk fucked around with this message at 14:48 on Dec 16, 2011 |
# ? Dec 16, 2011 02:47 |
Looks really cool and I can't wait to try it out.
|
|
# ? Dec 16, 2011 02:54 |
|
lord funk posted:
I took the last one, JM.... Congrats on finishing a really awesome looking app, looking forward to trying it out!
|
# ? Dec 16, 2011 02:56 |
|
lord funk posted:7TAAPRJEN6YJ
|
# ? Dec 16, 2011 02:58 |
|
lord funk posted:KFH43JFLN9RE Used this one. This looks pretty rad.
|
# ? Dec 16, 2011 04:09 |
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
AlwaysWetID34 fucked around with this message at 17:57 on Jan 18, 2019 |
# ? Dec 16, 2011 06:27 |
|
lord funk posted:Welp. Holy poo poo. It's done. drat, this is very well polished and customizable. Every time I looked at a new options menu, my jaw dropped. I wish there was a way to temporarily disable the four/five finger OS gestures and whatnot, but it seems that there is not. I kept inadvertantly changing apps and also had some touches dying that I suspect were also from the multitasking gestures.
|
# ? Dec 16, 2011 09:10 |
|
ManicJason posted:drat, this is very well polished and customizable. Every time I looked at a new options menu, my jaw dropped.
|
# ? Dec 16, 2011 14:47 |
|
I mean programmatically as a iOS app like disabling display sleep.
|
# ? Dec 16, 2011 16:51 |
|
ManicJason posted:I mean programmatically as a iOS app like disabling display sleep. When I looked for it, I couldn't find it. So the best I could do is prompt the user when they first open the app. Luckily, so far I haven't heard from any users who say it doesn't work because of it.
|
# ? Dec 16, 2011 20:02 |
|
It's a pretty cool app, I wish I was good at music
|
# ? Dec 16, 2011 20:39 |
|
So I've made some changes to the open GL stuff from earlier:code:
I will honestly buy someone a forum's upgrade if they help me understand this stuff.
|
# ? Dec 17, 2011 06:44 |
|
|
# ? May 16, 2024 09:05 |
|
For one, your triangles are crossing. Second, texture coordinates go from 0.0 to 1.0. You've figured out that you've got 6 points, and can probably figure out where in space they are, you just need to work on the order. So if you have these vertices (points): 4 5 2 3 0 1 then just figure out what order. You probably want 0-1-3, 0-3-2, 2-3-5, 2-5-4. The reason is that the "winding" (order you specify the vertices) of polygons in OpenGL needs to be counter-clockwise. (the order the actual polygons are specified doesn't matter for something like this) So, if you're drawing a sprite that's 150 pixels tall by 75 pixels wide, you're coordinates should be 0 - (0, 0) 1 - (75, 0) 2 - (0, 75) 3 - (75, 75) 4 - (0, 150) 5 - (75, 150) Since you need to specify the texture coordinate of each vertex, assuming you go with the same little vertex diagram I made above, your texture coords would be: (0.0, 0.0) (0.0, 0.0) (0.0, 0.5) (0.5, 0.5) (0.0, 1.0) (1.0, 1.0) edit: here, made you a demo. It uses glDrawElements() instead of glDrawArrays(), but it's commented and hopefully isn't hard to figure out. It's based off the base Cocos2D template, take a look at SRSquishySprite to see what I did. edit2: and, during the course of developing this, I realized that this way of squishing your sprite causes visible tearing across the image. It happens because the texture coordinates aren't interpolated the same across the "squished" polygons. edit3: also, I used a 128x256 image & sprite in the demo because OpenGL textures need to have power-of-two dimensions (32, 64, 128, etc.). If needed, Cocos2D will pad out images to the next biggest power-of-two dimension before handing them off to OpenGL, but this can add up to a significant amount of wasted memory if you have a lot of images that need to be padded out. So keep that in mind when creating your game's artwork. edit4: the reason for the counter-clockwise winding has to do with back face culling. OpenGL will try to discard polygons that are facing completely away from the camera, on the assumption that those polygons are on the opposite side of the 3D model and therefor aren't visible anyway, to keep from having to process and render polygons that the viewer can't see. So, you tell OpenGL which is the front face and which is the back face by specifying the polygon's vertices in a certain order, which happens to be counter-clockwise. Or you could just turn off back face culling, which I think Cocos2D does (since none of the polygons are for 3D models), but it's still something to be aware of when you're stuffing vertex arrays by hand. Doc Block fucked around with this message at 09:06 on Dec 17, 2011 |
# ? Dec 17, 2011 08:00 |