Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 33 34 [35] 36 37 ... 91

Author Topic: Programming Help Thread (For Dummies)  (Read 100857 times)

Kofthefens

  • Bay Watcher
  • Keep calm and OH GOD CAPYBARAS
    • View Profile
    • Marshland Games
Re: Programming Help Thread (For Dummies)
« Reply #510 on: February 12, 2012, 05:17:40 pm »

Strangely enough my program isn't registering keyboard input. Can anybody figure out why? This in Java, by the way.

Code: [Select]
code

Surely that's not everything. I'm seeing lots of undeclared variables and methods. I'm not seeing any declaration of any kind of GUI components either.

Oh, sorry, I condensed the 1000+ lines of code.

If you really want it though...
Spoiler (click to show/hide)
Logged
I don't care about your indigestion-- How are you is a greeting, not a question.

The epic of Îton Sákrith
The Chronicles of HammerBlaze
My website - Free games

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #511 on: February 12, 2012, 05:19:35 pm »

I'm very curious, what does it take to make a simple interface for a game, a menu for example? Generally at least. Also what kind of libraries are needed for this?
You're using C++, right? I've been looking around for libraries but haven't implemented any, yet. Writing your own is challenging and will keep you busy for a while...
I'm probably going to be using CEGUI, but haven't implemented it yet.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

olemars

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #512 on: February 12, 2012, 05:26:36 pm »

I use Qt for anything interfacey. And a lot of things that are less interfacey too actually.
For a GUI overlayed on a 3D scene, then cegui is decent, especially if using Ogre (which is also excellent).
Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #513 on: February 12, 2012, 05:33:27 pm »

Strangely enough my program isn't registering keyboard input. Can anybody figure out why? This in Java, by the way.

Code: [Select]
code

Surely that's not everything. I'm seeing lots of undeclared variables and methods. I'm not seeing any declaration of any kind of GUI components either.

Oh, sorry, I condensed the 1000+ lines of code.

If you really want it though...
Spoiler (click to show/hide)

My apologies. I was thinking maybe you were trying to use a KeyListener in a console app. I suppose I should have just mentioned it in my original post.
Logged

Kofthefens

  • Bay Watcher
  • Keep calm and OH GOD CAPYBARAS
    • View Profile
    • Marshland Games
Re: Programming Help Thread (For Dummies)
« Reply #514 on: February 12, 2012, 05:34:59 pm »

No problem. I hope I didn't forget to copy any classes. Also, the keyListener isn't the only thing wrong, so if you try to run it don't be dismayed.
Logged
I don't care about your indigestion-- How are you is a greeting, not a question.

The epic of Îton Sákrith
The Chronicles of HammerBlaze
My website - Free games

Shades

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #515 on: February 12, 2012, 05:44:23 pm »

I'm very curious, what does it take to make a simple interface for a game, a menu for example? Generally at least. Also what kind of libraries are needed for this?

All depends on your game really. For example ncurses is great for text interfaces, and trivial to use.
Windowing toolkits such as a Qt or FLTK are great for more application style interfaces.

If you want to render completely in OpenGL, which is probably best for a 3D game, then Siquo's choice of CEGUI is your best bet, although overly complex compared to the windowing toolkits imo. It work with a number of different rendering engines though and is very powerful. Alternatively if your using a fully featured 3D engine they will come with a gui toolkit, Unity is a popular choice right now.

Those all assume you use C++ (or C). Other languages change your options some what. Java has a library for UI built in, and Python provides pygame and a lot of features through that.
Really comes down to what you want to make.
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

Urist McScoopbeard

  • Bay Watcher
  • Damnit Scoopz!
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #516 on: February 12, 2012, 05:52:28 pm »

Cool, Right now i'm going through the learncpp tutorials and just happened to think about it. The first game I write will inevitably be text/ascii based so I'm interested in a basic interfacing library (like some that have been suggested) after that if I get better I will invariably make another text/ascii based game, so on, and so on. Eventually I'd like to get a proper engine written and base any number of, hopefully enjoyable, games off of it. 3d is a long way off for me (if im interested at all) so im not too worried about it. Thanks for all the suggestions
Logged
This conversation is getting disturbing fast, disturbingly erotic.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #517 on: February 12, 2012, 06:02:15 pm »

Then you might want to go for something like libtcod. It's nice as a starter ascii-game-library.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #518 on: February 12, 2012, 06:09:03 pm »


Alternatively if your using a fully featured 3D engine they will come with a gui toolkit, Unity is a popular choice right now.

Those all assume you use C++ (or C). Other languages change your options some what. Java has a library for UI built in, and Python provides pygame and a lot of features through that.
Really comes down to what you want to make.

except unity doesn't use c++
well, the pro version (which cost a lot of money) can call c++ funtcions,
but regular unity is for c#
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Kofthefens

  • Bay Watcher
  • Keep calm and OH GOD CAPYBARAS
    • View Profile
    • Marshland Games
Re: Programming Help Thread (For Dummies)
« Reply #519 on: February 12, 2012, 06:12:28 pm »

I should probably mention that the keys WERE working at somepoint, back before I added the menubar. I have also changed other things since then.
Logged
I don't care about your indigestion-- How are you is a greeting, not a question.

The epic of Îton Sákrith
The Chronicles of HammerBlaze
My website - Free games

Whitefoxsniper

  • Bay Watcher
  • something meaningful.
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #520 on: February 15, 2012, 05:12:53 pm »

I'm working on a firefox plugin based in javascript. I want the thing to look up every H1 element and add an iframe next to it. In javascript is there a way to change specific parts of the code after the document has loaded?

Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #521 on: February 15, 2012, 05:22:47 pm »

I'm working on a firefox plugin based in javascript. I want the thing to look up every H1 element and add an iframe next to it. In javascript is there a way to change specific parts of the code after the document has loaded?

Something like this?
Logged

Whitefoxsniper

  • Bay Watcher
  • something meaningful.
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #522 on: February 15, 2012, 06:01:40 pm »

Something like this?

Nope I did a little bit of digging and found that what I wanted was appendChild()
Although it adds it to the inside of the H1 instead of after the </h1> so it's not perfect but it works.
Logged

Starver

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #523 on: February 16, 2012, 01:16:34 am »

Not familiar with the actual firefox/javascript dialect, but in another language I use, there's not only AppendChild[1]-analogue, but also an AppendSibling[2] and others.

But if not available...  Any possibility of effectively doing "AppendChild(ParentOf(TargetItem))"?

(Or equivalent in OO terms.)

You'd start with:
Code: [Select]
<Whatever>
  <Target>Target!</Target>
</Whatever>
...and then, searching for <Target> tags, the ParentOf() for each would (in this particular case) identify <Whatever> and run AppendChild() upon that to get.

Code: [Select]
<Whatever>
  <Target>Target!</Target>
  <AppendedThing />
</Whatever>



[1] Which would put it inside...
Code: [Select]
<Parent>
  <Contents data="This would be a child"/>
  <Contents data="This would be another child, perhaps the one you append"/>
</Parent>

[2]
Code: [Select]
<Parent>
  <ChildOfParent />
  <SiblingOfChildOfParent />
</Parent>
Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #524 on: February 16, 2012, 02:28:34 am »

appendChild()

Near the end, this link mentions insertBefore(). Would that work?
Logged
Pages: 1 ... 33 34 [35] 36 37 ... 91