Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 479 480 [481] 482 483 ... 796

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

XXXXYYYY

  • Bay Watcher
  • Been a long time.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7200 on: April 16, 2015, 08:59:19 pm »

I've recently been experimenting with graphics in Python 2.7, but I can't seem to find a decent library, save for pygame (Which I've yet to find a decent tutorial for) and pyOpenGL (Which crashes outright when I try to import it for some reason). What libraries would you recommend? I'd like to use graphics.py, but it would appear to be Python 3 only. Is there an older version of that somewhere, or will I just have to either find a different library, or finally get around to using Python 3?
The one here should work for both, unless the page is blatantly lying.  I should warn you that it's a very slow library.

Pygame is really great, actually. If you can't find a tutorial you can usually get away with looking at the documentation for something that does what you're looking for.
I can agree with this. Other than a few weird things (like how the Rectangle class drawing off the bottom of the screen if placed too low, despite the fact that the coords should have made it only 10px tall, for reasons I have no idea about), pygame generally works quite well.
Logged
Oooooooo. I know. ClF3. That should be a fun surprise.

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7201 on: April 16, 2015, 11:22:36 pm »

actually, JS doesn't get translated to C# behind the scenes

It gets translated to Boo, apparently.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7202 on: April 16, 2015, 11:31:37 pm »

I tried Boo for a bit. Decided that it would probably be better to just learn C# than to let the python-ish syntax confuse me (into accidentally writing Python code).

More importantly: wow that's odd

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #7203 on: April 17, 2015, 12:02:43 am »

Wait, what? Why would it use Boo?
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7204 on: April 17, 2015, 12:50:55 am »

The one here should work for both, unless the page is blatantly lying.  I should warn you that it's a very slow library.

Pygame is really great, actually. If you can't find a tutorial you can usually get away with looking at the documentation for something that does what you're looking for.
I can agree with this. Other than a few weird things (like how the Rectangle class drawing off the bottom of the screen if placed too low, despite the fact that the coords should have made it only 10px tall, for reasons I have no idea about), pygame generally works quite well.
AFAIK there are no glitches in pygame's rectangles, how are you writing it out?  The format is (xCordinate,yCordinate,width,height).
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule

Araph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7205 on: April 17, 2015, 01:01:40 am »

In a haze of sleep deprivation and delirium, I recorded the C# tutorial videos to go along with the JavaScript ones. If anyone's interested in learning how to program, I should have them up by tomorrow.
Logged

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #7206 on: April 17, 2015, 02:12:35 am »

AFAIK there are no glitches in pygame's rectangles, how are you writing it out?  The format is (xCordinate,yCordinate,width,height).
I think I remember that being a bug a while back? Must have been fixed.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

XXXXYYYY

  • Bay Watcher
  • Been a long time.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7207 on: April 17, 2015, 02:33:35 pm »

AFAIK there are no glitches in pygame's rectangles, how are you writing it out?  The format is (xCordinate,yCordinate,width,height).
I think I remember that being a bug a while back? Must have been fixed.
I rewrote my code, but I have an old version of it lying around. Here's the relevant stuff:
Code: [Select]

##Inside the button class. Anything not shown is calculated elsewhere, and works.
    def __init__(self,pos,result,h_length,v_length,text,active,activecolor,pressedcolor,pressdelay):
        self.pos,self.result,self.h_length,self.v_length,self.text,self.active,self.activecolor,self.pressedcolor,self.pressdelay=pos,result,h_length,v_length,text,active,activecolor,pressedcolor,pressdelay
        #^ The massive arg-to-self line
        self.counter=0
        self.color=activecolor
        self.boundry=[self.pos,[self.pos[0]+self.h_length,self.pos[1]+self.v_length]]

    def draw(self,screen):
        pygame.draw.rect(screen,self.color,self.boundry,1)
        rendertext(screen,self.text,self.pos,color=(255,255,255))


##the Button being declared:
spinbutton=Button([10,200],chooser.addvel,200,30,"Spin",1,(0,0,0),(125,125,125),10)
Then spinbutton is drawn to the screen like normal. Moving the button up a bit fixes the problem, but changing the v_length doesn't.
For the record, the Rectangle actually takes in (screen,color,Rectangle,width), where Rectangle is a list of position tuples (or lists ofc)
Logged
Oooooooo. I know. ClF3. That should be a fun surprise.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7208 on: April 17, 2015, 03:41:33 pm »

Wait, what? Why would it use Boo?
Boo is the native language invented by Unity, they were basically able to design it however they liked. So it would be easier to use that internally than try and recode JavaScript into C#. The main block there is that C# is strongly typed, and JavaScript has dynamic typing. Trying to seamlessly work out all the types that should have been in a JavaScript if it had been written as C# would be hard to implement correctly for any possible program that people could think up.
« Last Edit: April 17, 2015, 03:46:43 pm by Reelya »
Logged

Araph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7209 on: April 17, 2015, 08:49:20 pm »

JavaScript
Part 1
Part 2
Part 3

C#
Part 1
Part 2
Part 3

TIL 80% of Unity's users prefer C# over JavaScript. Huh.
Logged

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7210 on: April 18, 2015, 03:08:23 am »

That's because C# is great.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

TheDarkStar

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7211 on: April 18, 2015, 10:22:16 am »

If I use C++, what library for UI or other graphics things should I use?
Logged
Don't die; it's bad for your health!

it happened it happened it happen im so hyped to actually get attacked now

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7212 on: April 18, 2015, 02:48:56 pm »

That will depend on a couple of things.  What OS (Linux, Windows?) are you working with and what are you trying to do?  I'm pretty out of the loop here in general, but others might have some suggestions.  I know Qt is a widely used library on Linux at least, but can't comment on how good it is.
Logged
Through pain, I find wisdom.

TheDarkStar

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7213 on: April 18, 2015, 02:55:16 pm »

Windows; I'm not entirely sure yet, but I need to know what kind of options I have.
Logged
Don't die; it's bad for your health!

it happened it happened it happen im so hyped to actually get attacked now

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7214 on: April 18, 2015, 05:51:46 pm »

You can use something like GTK+ which will give you cross-platform UI. I'd recommend avoiding anything that's too Windows-specific. If you really want raw graphics for a game, go for OpenGL and build your own UI system inside it.
« Last Edit: April 18, 2015, 05:54:11 pm by Reelya »
Logged
Pages: 1 ... 479 480 [481] 482 483 ... 796