Changing the current view controller?
Moderator: Coders of Rage
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Changing the current view controller?
I'm using OpenGL ES and the file I'm currently editing is called EAGLView.h/m ... I think it's a viewcontroller, not sure though. I was thinking about how to do a game with it and I started designing the title page. Then I realized... how would I draw depending on what section of the game I'm on? (title, menu, actual game, ending etc...). Then I thought maybe I'd have to switch the controller of the view and set up a whole new EAGLView2.h/m and do that. Is this the best way? If so, then how do you do it?
Basically my Classes folder will be:
EAGLViewTitle.h
EAGLViewTitle.m
EAGLViewMenu.h
EAGLViewMenu.m
Any help?
Basically my Classes folder will be:
EAGLViewTitle.h
EAGLViewTitle.m
EAGLViewMenu.h
EAGLViewMenu.m
Any help?
Last edited by ibly31 on Sat Aug 01, 2009 4:45 pm, edited 1 time in total.
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- Innerscope
- Chaos Rift Junior
- Posts: 200
- Joined: Mon May 04, 2009 5:15 pm
- Current Project: Gridbug
- Favorite Gaming Platforms: NES, SNES
- Programming Language of Choice: Obj-C, C++
- Location: Emeryville, CA
- Contact:
Re: Changing the current view conntroller?
Just use "states" or (depending on how complex your game is) a "screen" class of sorts. Don't change the viewer, just change the code sent to the viewer.ibly31 wrote:I'm using OpenGL ES and the file I'm currently editing is called EAGLView.h/m ... I think it's a viewcontroller, not sure though. I was thinking about how to do a game with it and I started designing the title page. Then I realized... how would I draw depending on what section of the game I'm on? (title, menu, actual game, ending etc...). Then I thought maybe I'd have to switch the controller of the view and set up a whole new EAGLView2.h/m and do that. Is this the best way? If so, then how do you do it?
Basically my Classes folder will be:
EAGLViewTitle.h
EAGLViewTitle.m
EAGLViewMenu.h
EAGLViewMenu.m
Any help?
You can still set it up like:
Title.h
Title.m
Menu.h
Menu.m
Within those have your draw code, mouse/keyboard input code, etc.
Current Project: Gridbug
Website (under construction) : http://www.timcool.me
Website (under construction) : http://www.timcool.me
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: Changing the current view conntroller?
I don't understand... sorry, I'm new to iphone programming. But I have a single EAGLView.m view controller that I'm running with a "drawView" method... how do I tell the program to start running EAGLViewTitle.h/m or EAGLViewMenu.h/m?
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- Innerscope
- Chaos Rift Junior
- Posts: 200
- Joined: Mon May 04, 2009 5:15 pm
- Current Project: Gridbug
- Favorite Gaming Platforms: NES, SNES
- Programming Language of Choice: Obj-C, C++
- Location: Emeryville, CA
- Contact:
Re: Changing the current view conntroller?
This isn't all that different from programming for a PC. You'll have to "#import" your files to access their methods. Also the EAGLView is the context you draw into, so you shouldn't have multiple EAGLViews. That's what I was trying to say in my previous post. Other than that, you'll have to post some code if you want more specific help. I'm not an expert (I'm learning this stuff too), but I'll try to help.ibly31 wrote:I don't understand... sorry, I'm new to iphone programming. But I have a single EAGLView.m view controller that I'm running with a "drawView" method... how do I tell the program to start running EAGLViewTitle.h/m or EAGLViewMenu.h/m?
Current Project: Gridbug
Website (under construction) : http://www.timcool.me
Website (under construction) : http://www.timcool.me
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: Changing the current view conntroller?
Okay, I guess I understand somewhat. So I could have a menu() function defined in Menu.h and implemented in Menu.m, and in the main EAGLView class I could call it? I'm still kind of confused though, my Menu() function would have pretty much all the same code my EAGLView stuff has... a setupView: and drawView: function... In case you are unfamiliar with OpenGL ES projects, they have a drawView: function called every frame, and thats all I can really edit... should I just have a bunch of if statements like this:
if(current thing is splash screen)
splash();
if(current = menu)
menu();
and each of thoe will display what i want? and those will be defined in the menu.h and menu.m?
if(current thing is splash screen)
splash();
if(current = menu)
menu();
and each of thoe will display what i want? and those will be defined in the menu.h and menu.m?
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: Changing the current view conntroller?
Bump, is that correct?
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- Innerscope
- Chaos Rift Junior
- Posts: 200
- Joined: Mon May 04, 2009 5:15 pm
- Current Project: Gridbug
- Favorite Gaming Platforms: NES, SNES
- Programming Language of Choice: Obj-C, C++
- Location: Emeryville, CA
- Contact:
Re: Changing the current view conntroller?
ibly31 wrote:Okay, I guess I understand somewhat. So I could have a menu() function defined in Menu.h and implemented in Menu.m, and in the main EAGLView class I could call it? I'm still kind of confused though, my Menu() function would have pretty much all the same code my EAGLView stuff has... a setupView: and drawView: function... In case you are unfamiliar with OpenGL ES projects, they have a drawView: function called every frame, and thats all I can really edit... should I just have a bunch of if statements like this:
if(current thing is splash screen)
splash();
if(current = menu)
menu();
and each of thoe will display what i want? and those will be defined in the menu.h and menu.m?
Sorry, I went camping and I just got back today. It also happens to be my Birthday so I'm going to make this short. I've dabbled in OpenGL ES, nothing too serious, but I am familiar with the basic structure. Like you've stated: SetupView (depending on implementation) should really only be called once to set up the viewing context. DrawView will be called multiple times. It appears like you get the gist of what I was saying though.ibly31 wrote:Bump, is that correct?
Current Project: Gridbug
Website (under construction) : http://www.timcool.me
Website (under construction) : http://www.timcool.me
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Changing the current view conntroller?
[offtopic]
@Innerscope:
[/offtopic]
@Innerscope:
[/offtopic]
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- imran.hoshimi
- Chaos Rift Newbie
- Posts: 12
- Joined: Mon Dec 01, 2008 4:57 am
- Current Project: Nothing. :(
- Favorite Gaming Platforms: PC, XBox360, PS2, SNES and almost all of them.
- Programming Language of Choice: C/C++
- Location: Karachi, Pakistan.
- Contact:
Re: Changing the current view conntroller?
Take a look at this blog ->
http://www.71sqaured.co.uk
The guy has a whole bunch of video tutorials dealing with game programming on the iPhone. From texture mapping to tiling and what not. He discusses everything in a very simple way.
http://www.71sqaured.co.uk
The guy has a whole bunch of video tutorials dealing with game programming on the iPhone. From texture mapping to tiling and what not. He discusses everything in a very simple way.
- Innerscope
- Chaos Rift Junior
- Posts: 200
- Joined: Mon May 04, 2009 5:15 pm
- Current Project: Gridbug
- Favorite Gaming Platforms: NES, SNES
- Programming Language of Choice: Obj-C, C++
- Location: Emeryville, CA
- Contact:
Re: Changing the current view conntroller?
should be http://www.71squared.co.uk/imran.hoshimi wrote:Take a look at this blog ->
http://www.71sqaured.co.uk
The guy has a whole bunch of video tutorials dealing with game programming on the iPhone. From texture mapping to tiling and what not. He discusses everything in a very simple way.
Interesting blog though, nice find.
And thanks for the birthday comment Dandymcgee
Current Project: Gridbug
Website (under construction) : http://www.timcool.me
Website (under construction) : http://www.timcool.me