Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 193 194 [195] 196 197 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 887558 times)

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2910 on: September 14, 2012, 11:59:59 pm »

Haha, I'm trying to learn C++ now the same way I learned how to mod DF: using a shitload of online resources and referencing the code of pre-existing software made by those more skilled than me.

Except instead of DF wiki it's google and various C++ tutorials and instead of Deon's Genesis Mod it's SLASH'EM.

The best way to learn something is to keep trying until you stop failing.

Unfortunately, with programming, that point doesn't ever really come.

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2911 on: September 15, 2012, 12:07:45 am »

Haha, I'm trying to learn C++ now the same way I learned how to mod DF: using a shitload of online resources and referencing the code of pre-existing software made by those more skilled than me.

Except instead of DF wiki it's google and various C++ tutorials and instead of Deon's Genesis Mod it's SLASH'EM.
Pretty much how I learned!

I like to call it: Bashing one's head against the keyboard until it works.
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2912 on: September 15, 2012, 01:37:43 am »

I thought that's how everyone learned C++. :s
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2913 on: September 15, 2012, 05:42:36 am »

I thought that's how everyone learned C++. :s

Thats not how I learned C++ :D

I sure do love my C++ book, but it takes FOREVER to get through, just because it's super in depth,
in an online book review, I read something along the lines of
"If you were to compare programming concepts to food, and say you needed an egg for something, if you use an online resource, it will tell you, this is an egg, this is how you use it, these are other types of eggs, etc. and that may be very good and well because thats all you really need, but this book tells you what eggs are, where they come from, the different colors and textures they can have, all the animals that lay eggs, all the foods that can be made with eggs, etc."

Really it's a very boring and slow book, and many of the things it says I really figured out just by reading the previous parts of the book, like, it taught arrays, and then objects, and then how to make an array of objects, and how to make an object with arrays in it, I would have figured you can put arrays in objects and that you can have an array of objects, but the book always has a thing or two that here helpful, that I wouldn't have known if I had figured I knew those parts already and had skipped them,

Like how to use constructors with parameters for objects in an array.
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.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2914 on: September 15, 2012, 05:46:07 am »

Well, if you have had at least one error that isn't simple, you're learning C++ by bashing your head on the keyboard until it works, too. :3
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2915 on: September 15, 2012, 06:32:36 am »

yeah, then I guess you're right, lol :P

In other news

https://en.wikipedia.org/wiki/Piet_%28programming_language%29

this..
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.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2916 on: September 15, 2012, 06:55:40 am »

There are many esoteric programming languages in the world ... xD

I liked the "recipe" style one.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2917 on: September 17, 2012, 02:16:59 am »

I've a problem with custom graphics on button in java.

I've a jbutton, for which I use graphics.drawImage to perform compositing between different image states. I fought hard and won against blitting and transparencies, which doesn't work so nicely when you have multiple button overlapping each with its own transparent custom drawing, but now I'm stuck with another problem:


Spoiler (click to show/hide)

all those buttons are in a scrollable viewport, but the custom image doesn't obey the component clipping, so the image gets drawn OVER the scrollbars. (and over the quit panel, sometimes)

now, does anyone know how to set the z-order of g2d.drawImage OR how to get the clip rectangle of the viewport a component is in? should work either way.


edit: nevermind I was messing with bounds in a superclass.
« Last Edit: September 17, 2012, 05:29:32 am by LoSboccacc »
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2918 on: September 17, 2012, 08:21:42 am »

I've a problem with custom graphics on button in java.

I've a jbutton, for which I use graphics.drawImage to perform compositing between different image states. I fought hard and won against blitting and transparencies, which doesn't work so nicely when you have multiple button overlapping each with its own transparent custom drawing, but now I'm stuck with another problem:


Spoiler (click to show/hide)

all those buttons are in a scrollable viewport, but the custom image doesn't obey the component clipping, so the image gets drawn OVER the scrollbars. (and over the quit panel, sometimes)

now, does anyone know how to set the z-order of g2d.drawImage OR how to get the clip rectangle of the viewport a component is in? should work either way.


edit: nevermind I was messing with bounds in a superclass.

Funny, I'm working with pretty much the same stuff for a school project. Tips?

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2919 on: September 17, 2012, 08:45:29 am »

Funny, I'm working with pretty much the same stuff for a school project. Tips?

I've a ton, but you should properly better define where you need hints.

I can point you toward this
http://www.muntjak.de/hans/java/tinylaf/index.html

which is a java look&feel with an integrated editor that can make any generic boring java application in a serious business program
Spoiler (click to show/hide)


then, if you need that gameish touch so that button looks like embedded into the panel looking like active elements it is, well, more complicate because you can't trust mouse status, but you can do with proper listeners:

Spoiler (click to show/hide)


note that I've manually edited out useless parts from the widget class so it may not compile as such, but it is quite close.

if you have some question, ask freely.

edit: to clarify - here are the rollover and pressed image I use
Spoiler (click to show/hide)

they compose around the button image without blocking it from view
« Last Edit: September 17, 2012, 09:19:45 am by LoSboccacc »
Logged

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2920 on: September 20, 2012, 05:41:36 pm »

in c++  is  a = b = c = d = e = f = 5;  valid, and would it initialize 'a' through 'f' to 5?

also, making an array of pointers,
I need an array of 12 SDL_Surface pointers,  so would I just do SDL_Surface*[12];  or what?
« Last Edit: September 20, 2012, 05:46:06 pm by Valid_Dark »
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.

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #2921 on: September 20, 2012, 05:45:09 pm »

in c++  is  a = b = c = d = e = f = 5;  valid, and would it initialize 'a' through 'f' to 5?
98% positive that is correct on both counts. But my c++ is rusty.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2922 on: September 20, 2012, 05:47:16 pm »

Yes, that would initialize them all to 5 (starting with f, though the order doesn't matter in this case).

I do that sort of thing sometimes for constructors and the like.

also, making an array of pointers,
I need an array of 12 SDL_Surface pointers,  so would I just do SDL_Surface*[12];  or what?
Two ways to do that (depending if you want a variable array size or a set one).

SDL_Surface VariableName[12]; //empty uninitialized array of size 12. Size is hardcoded.
SDL_Surface* VariableName = new SDL_Surface[12]; //empty uninitialized array of size 12. Size can be set with a variable and is not hardcoded. Note you have to delete this one at the end or you'll get leaks.
« Last Edit: September 20, 2012, 05:52:18 pm by kaijyuu »
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2923 on: September 20, 2012, 06:01:48 pm »

This is driving me nuts,
so i'm programming this thing, right?  and about a month or 2, I wanted to program a different part of it, even though it wasn't ready for it, so I programmed that other part independent of it, as it's own program, just to figure out the mechanics for how it works, and now i'm having a retardedly hard time putting it together.

now I understand why it's important to leave notes in your code.

I think I just need to have a cigarette and get a fresh start on this.


well there are some notes, but they are the most unhelpful notes you could ever imagine,
there are only notes on things that are super obvious as to what they do -__-"
« Last Edit: September 20, 2012, 06:13:07 pm by Valid_Dark »
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.

dreadmullet

  • Bay Watcher
  • Inadequate Comedian
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2924 on: September 20, 2012, 06:53:23 pm »

Yes, that would initialize them all to 5 (starting with f, though the order doesn't matter in this case).

I do that sort of thing sometimes for constructors and the like.

also, making an array of pointers,
I need an array of 12 SDL_Surface pointers,  so would I just do SDL_Surface*[12];  or what?
Two ways to do that (depending if you want a variable array size or a set one).

SDL_Surface VariableName[12]; //empty uninitialized array of size 12. Size is hardcoded.
SDL_Surface* VariableName = new SDL_Surface[12]; //empty uninitialized array of size 12. Size can be set with a variable and is not hardcoded. Note you have to delete this one at the end or you'll get leaks.

Valid_Dark was asking how to create an array of pointers, not the SDL_Surfaces themselves:
Code: [Select]
SDL_Surface* VariableName[12];
SDL_Surface** VariableName = new SDL_Surface*[12];
Logged
Pages: 1 ... 193 194 [195] 196 197 ... 796