• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

PeterJobs

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

106 Neutral

About PeterJobs

  • Rank
    Newbie
  1. Yeah, I know, my doubt is more related to basic programming than anything else. Now I did read the links you recommended properly, and I'm starting to understand a bit more about the problems related to floating comparisons (although it looks like I'm way too noob to get some of those stuff as of now). And a TimerFunc, in the case I need, looks a better option (than an IdleFunc). Thanks for your reply, 'cause it opened my eyes to problems I didn't know existed. I'll just test and study more to get to the result I want.
  2. Sorry, hadn't seen the code was still posted broken. I'll try it again: [source lang="cpp"]void Timer(int value) { if (posInitialxObject == -1.5) { while (posInitialxObject != posFinalxObject) posInitialxObject += -0.1; } else { while (posFinalxObject != posInitialxObject) posInitialxObject -= -0.1; } glutPostRedisplay(); glutTimerFunc(33, Timer, 1); }[/source] The -1.5 was the initial X position of the object on the screen. Until that position was different then -2.3, the X variable should decrease -0.1, making it translate. Now I've created two global variables w/ the initial and final position, so I'm comparing these two.
  3. I'm sorry, my Timer function didn't appear correctly, so I'm posting it here: [source lang="cpp"]void Timer(int value) { if (positionObject == -1.5) { while (positionObject <= -2.3) positionObject += -0.1; } else { while (positionObject != -1.5) positionObject -= -0.1; } glutPostRedisplay(); glutTimerFunc(33, Timer, 1); }[/source]
  4. Hi everyone! I needed a little help with a similar question this morning, but in this one I'm really stuck and don't know what I'm doing, so any help will be appreciated. I have to move smoothly an object from one side of my 3d room to another, every time a single key is pressed. I declare a global variable with the initial x position of it, and then I render it: [source lang="cpp"]glPushMatrix(); glTranslatef(positionObject, 1, -6); object->Render(); glPopMatrix();[/source] So I guess that, for the smooth movement, I'll need a timer that shows the object position several times per second, right? I'm doing it like this (not the proper way to do it, I'm aware): [source lang="cpp"]void Timer (int value) { if (positionObject == -1.5) { while (positionObject <= -2.3) positionObject += -0.1; } else { while (positionObject != -1.5) positionObject -= -0.1; } glutPostRedisplay(); glutTimerFunc (33, Timer, 1); }[/source] And my final doubt is: what do I call in my keyboard callback function for it to work? [source lang="cpp"]void KeyboardCallback (unsigned char key, int x, int y){ switch (key) { case 'r': case 'R': //do sth; break; } }[/source]
  5. Guys, thank you all for your answer. All your considerations were basically right, and now it is rotating perfectly. The main problem was that I wasn't applying glRotate when the object was first called and rendered. You guys rock.. thanks once again!
  6. [color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3][background=rgb(250, 250, 250)]Good morning guys,[/background][/size][/font][/color] [color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3][background=rgb(250, 250, 250)]I'm having difficulties in rotating an imported .obj when the key 'C' is pressed. I think my problem is with my KeyboardCallback function, but still, I can't figure out how to do it properly. My program compiles, but nothing happens when the key is pressed.[/background][/size][/font][/color] [color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3][background=rgb(250, 250, 250)]First, I declare some static pointes to the .objs that I'm importing:[/background][/size][/font][/color] [source lang="cpp"]static Mesh *book, *can, *table;[/source] [color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3][background=rgb(250, 250, 250)]Then I render the objects:[/background][/size][/font][/color] [source lang="cpp"]void Render(void){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); if (book) { glPushMatrix(); glTranslatef(0, -2, -8); book->Render(); glPopMatrix(); } .... }[/source] [color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3][background=rgb(250, 250, 250)]That all works perfectly fine. And here my doubts start. My KeyboardCallback function:[/background][/size][/font][/color] [source lang="cpp"]void KeyboardCallback(unsigned char key, int x, int y){ switch (key) { case 27: exit(0); break; case 'c': case 'C': RotateBook(book); break; }[/source] [color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3][background=rgb(250, 250, 250)]And finally, my RotateBook function:[/background][/size][/font][/color] [source lang="cpp"]void RotateBook(Mesh *){ glPushMatrix(); glRotatef(45, 0, 1, 0); book->Render(); glPopMatrix(); }[/source] [color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3][background=rgb(250, 250, 250)]Can someone please indicate what I'm doing wrong?[/background][/size][/font][/color] [color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3][background=rgb(250, 250, 250)]Thanks in advance.[/background][/size][/font][/color]