• Content count

  • Joined

  • Last visited

Community Reputation

353 Neutral

About BKrenz

  • Rank
  1. Java, AWT Image not Appearing

      I suppose I can try to hide it a bit better. The only real thing I've overwritten is the AWTRenderer's (as a JPanel) paintComponent() method, which I don't see how I could have avoided. The draw method is inherited from a Renderer interface.   The AWTRenderer is really the only thing that needs to know about JFrames and JPanels. The actual drawing should happen like the AWTImage does. I've tried my best to create a layer of Abstraction over everything that's AWT specific. I think the only thing that's not currently are the Assets, which I'm planning on changing over to the Renderer knowing what kind of AssetFactory to create and having the AssetManager pull from the Renderer to get that.    EDIT: To reiterate, as I'm not sure I was clear, the invokeLater isn't part of a function that's overriding a Component function.   EDIT 2: The reason I extended the JPanel originally was because in order to draw on it, I needed a reference to its Graphics component, which is given in the paint component function.
  2. Java, AWT Image not Appearing

      I'll look into doing this. I sort of see how, but I need to think through how to hide it behind the interfaces I use since it's AWT specific. Will report back.   EDIT: Oh, wait duh. Just changed the draw(GameScreen) method in AWTRenderer to: @Override public void draw(GameScreen p_Screen) { this.m_Screen = p_Screen; SwingUtilities.invokeLater( new Runnable() { @Override public void run() { m_Frame.repaint(); } }); } Seems to be working now!
  3. Java, AWT Image not Appearing

      Here's the full AWTRenderer class:   [spoiler] package com.stranded.graphics.awt; import java.awt.Color; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; import com.stranded.graphics.interfaces.IRenderer; import com.stranded.reference.GameOptions; import com.stranded.reference.GameStrings; import com.stranded.screens.GameScreen; /** * Shell for the Render Engine * To be implemented later * */ public class AWTRenderer extends JPanel implements IRenderer{ /** * */ private static final long serialVersionUID = -4275037581723785182L; /* Class Members */ private Graphics m_Graphics; private GameScreen m_Screen; private JFrame m_Frame; private int m_TestLocAdd; public AWTRenderer () { this.m_Frame = new JFrame(GameStrings.WINDOW_TITLE + " " + GameStrings.VESION_NUMBER); this.m_Frame.add(this); this.m_TestLocAdd = 0; } public void init() { this.m_Frame.setSize(GameOptions.DISPLAY_RESOLUTION_X, GameOptions.DISPLAY_RESOLUTION_Y); this.m_Frame.setDefaultCloseOperation(3); this.m_Frame.setLocationRelativeTo(null); this.m_Frame.setFocusable(true); this.m_Frame.setVisible(true); this.setVisible(true); } @Override public void destroy() { } @Override public void draw(GameScreen p_Screen) { this.m_Screen = p_Screen; this.repaint(); } public Graphics getGraphics() { return this.m_Graphics; } public JFrame getFrame() { return this.m_Frame; } public void setGraphics(Graphics p_Graphics) { this.m_Graphics = p_Graphics; } @Override public void paintComponent(Graphics g_Old) { super.paintComponent(g_Old); this.m_Graphics = g_Old; if (this.m_Screen != null) this.m_Screen.draw(this); this.m_Graphics.setColor(Color.BLACK); this.m_Graphics.fillRect(7, 7 + 72 + 9 + this.m_TestLocAdd, 201, 25); this.m_Graphics.setColor(Color.BLUE); this.m_Graphics.fillRect(8, 8 + 72 + 9 + this.m_TestLocAdd, 201, 24); this.m_TestLocAdd += 1; } } [/spoiler]   Whenever I want to redraw (which is currently done in the main loop, ) I call the draw(GameScreen) function in AWTRenderer. As the AWTRenderer is a JPanel itself, it tells itself to repaint.    EDIT: I did a little further investigation that I could think of, and tried have a rectangle on screen that moves around with just a simple move its location every time its drawn. However, it gets drawn the first time, and the screen doesnt seem to refresh. However, print statements there (crappy debugging method, I know ) and later down the call chain show the function is being called.   EDIT 2: Just remembered that resizing the screen makes it update. This has caused the image to be drawn, and the rectangle moves, but the screen never refreshes on its own.
  4. Java, AWT Image not Appearing

      Was not aware of this. However, I feel like the draw calls I'm making should be on that thread, as the calls are done when the Render is told to repaint. The draw call is done in the paintComponent method, as seen here: @Override public void paintComponent(Graphics g_Old) { super.paintComponent(g_Old); this.m_Graphics = g_Old; if (this.m_Screen != null) this.m_Screen.draw(this); } Edit: I realize the repaint method isn't called within the AWT thread. I'd have to implement the draw loop into that thread, I suppose, to make that happen. For now, that was just happening in the main loop. Could that be the cause?
  5. Not too sure this was the right place for this.   Code Repo Here I'm writing under the WorldReconfiguration branch.    I'm refactoring and rewriting bits of code for someone else. They were originally using AWT for their rendering basis. I've taken their code, and mostly abstracted it so that I can start moving things over to LWJGL or LibGDX painlessly in the near future. Couple issues left there, but I think it's mostly working.   Anyways, I almost finished the basis to the AWTRenderer, but have run into an issue. I'm attempting to render an image onto the panel, though it's not appearing. The code is running, not throwing any errors, but I can't figure out why it's not actually drawing.   The code in question is this couple of lines (located here) : Graphics l_Graphics = ((AWTRenderer) p_Renderer).getGraphics(); l_Graphics.drawImage( this.m_Image , p_XCoord, p_YCoord, GameOptions.TILE_SIZE, GameOptions.TILE_SIZE, null); Whenever I currently go to draw a scene, I tell the current GameScreen to draw, which calls the AWTRenderer and it repaints, which should tell the GameScreen to start drawing everything with the reference to the Renderer. The GameScreen tells the World to do its drawing, which currently passes the reference to a TileRegion, which passes the Reference to each Tile. The Tile then gets its GraphicsComponent and tells it to draw, which gets the associated GraphicsAsset and tells it to finally draw using the original reference to the Renderer. Bit convoluted in my opinion, but this is my first time doing this stuff.   Tried my first implementation of a CBES, too.   At this point, I've verified that l_Graphics is not null, that the code is running, and earlier up the call branch I can draw a rectangle which appears and should be using the same Graphics reference. Google hasn't really given me any answers, though I've always been bad at search strings. Also tried drawing a rectangle inside that function, but it doesn't appear either.   The issue, as far as I can tell, is with the Graphics. I don't have a solid understanding of AWT, and wasn't planning on it since I want to move libraries/APIs soon. I think it may be related to AWT paint function being called by what I think is a different thread when repaint is called.    Before I'm told to move to an engine or different library entirely, I'd like to just get this working. 
  6. Learning Graphics Development

      I generally don't like it when people give this advice. Yes, OpenGL is cross-platform, but anyone who has any experience with cross-platform (or even cross-vendor!) OpenGL development knows how much of a pain it is to get consistent results across platforms and hardware. I'd choose DirectX over OpenGL any time just to avoid the extension and driver compatibility hell.     I actually ended up going with DIrectX, via SharpDX. I'm not concerned with actual development at this point in time, and this is more of a side project type of thing than an actual career decision. 
  7. Learning Graphics Development

    Alright, thank you!
  8. Hello all!   I'm a somewhat capable programmer in general, currently taking some time off school for personal reasons. In the meantime, I've been reading books on more generalized software development concepts, and working on a few tiny projects for various things. While I'd have loved to get an internship in the industry, my current situation prevents that.   I've been interested in games for a while, and am interested in different aspects of developing them. Most recently, I've been wanting to dive into the world of graphics, and have done a minimal amount of research so far. I have one major concern before I start learning, and it's related to the new Vulkan and DX12 APIs. I've noted from various sources that the way of doing things is going to be changing, and that, at least for Vulkan, it should be public by the end of 2015.   My concern is that I would start diving into one of the APIs that are out now, DX11 or OGL4+, and would be harmed by learning about how things are currently accomplished.    Doing the math isn't a concern on my end, I'm fairly familiar with a lot of calculus, algebra, and geometry. From my understanding, matrices, and to a lesser extent, quaternions, are a major staple of 3D graphics.   My question is this: In order to ensure that I'm learning the more "correct" way of doing things, where should I be starting? Is just getting in and doing something in the current APIs the best way to go? I'm not sure where to start. Conceptually, I would think that many things will carry over well (VBOs, etc). However, implementations, and architectures, seem like they'll be changing drastically.    Please do note that I'm wanting to learn how to develop directly in the APIs, and not wanting to learn about different engine's ways of handling it or anything like that. 
  9. The State of the Indie World

    I think there is something to be said for Indies and their innovation - those games that truly are good are what shine and be successful. Look at Minecraft - millions of units sold, because it's one of the widest known (almost pure) sandbox game. The way the player is immersed in the world feels great, and how the game can be manipulated to create huge adventure maps, mini-games, huge mods, etc, just makes the game that much better.   This is what I feel Indie development really is. What people call Indie now is.. really just big business, on a small level. Business as usual. Get out as much as we can and sell it as fast as we can so we can fill our wallets. Those games are the ones that are force fed and make the market what it is today. It's just too hard to sift through everything for the actual gems. You occasionally see games pop up on Kickstarter that really do look awesome, and you know that just by listening to what the Devs say, and just how much they've already created, that the game will be awesome and will make an impact. Castle Story generated almost 9 times what they were asking for, and the game really looks like I could sink days of gameplay into it.   I feel gameplay innovation is spurred by the real Indie developers out there - those that do this because it's a dream, a passion, an obsession. And what are games without gameplay? Where would we be today without the indie developers who are fueling that innovation?   Essentially what I'm saying is that the world of Indie development as it's seen today is filled with garbage. I don't really call those games. I call those products. Something that's marketed because it won't sell otherwise. True Games are those things that market themselves - a friend of a friend of a friend played it and wasn't seen for a week because he got all of his friends and their friends into it.
  10. College Considerations

      Likely my fault for not clarifying that in the OP, my apologies.   Alright, thanks for the advice regarding that.
  11. College Considerations

    How do you mean? I had thought that for a programmer a website may be a good idea. Having a place to display projects and possibly a place to post blog posts if I feel it's something important I want to say.   I would like to clarify that programming is what I am interested in mainly. I don't yet know which direction I'll take it, but I definitely want to do something involving coding.
  12. College Considerations

    If your goal is to write software professionally, then YES, ABSOLUTELY, if your circumstances allow it.   The standard filter that HR uses is a computer science degree.    There are of course some exceptions, people who are professional programmers without a four year degree, but they are relatively rare these days and aging out of industry.   You don't compete in a vacuum. When people look at your job application they will see other people who do have a degree, and you who do not.  Which one will they pick?  Also, if they do pick you, it is well documented that workers without degrees are paid less than their peers.        I think you misunderstood the question. I wasn't referring to whether or not I should stay in college - I most definitely am doing that. I was asking opinions on how to move forward with degree and class choices. Thank you for the feedback, though. 
  13. Hello everyone!   I'm currently a second year college student with my current major as Computational Mathematics. I've kind of lost interest in the math side, though I'm still only in Calculus. The future courses required for my major include Linear Algebra, Discrete Math, Graph Theory, etc. I also have a bunch of required CS classes that I'll have to take.   My interest has shifted to Game development, specifically the programming side. I've been teaching myself some programming the past couple years, so I'm ahead of my peers. I have yet to actually make any games, though. I have a couple of ideas, and I'm fleshing out the ideas. However, no actual coding work has been done. I figure this is what I should work on. One big thing that really demotivated me recently was a talk I had with my professor. I told him I'd been teaching myself and was currently reading Bjourne Stroustrup's latest C++ book (4th ed.). He ended up recommending that I wait to learn CS concepts and whatnot in classes, instead of teaching myself. That kind of seemed unprofessional to me: stifling a student's drive to go above and beyond.   With my main interests shifting, I've been considering switching to either CS or Software Engineering. The school offers a Game Design and Development degree, but I would feel a lot safer with either the CS or SE degree. I don't know specifically what I want to do as a career. I'm kind of shying away from a Game Dev career, and right now I think I'd rather keep it as a hobby.   Because of personal circumstances, I had to leave my first year of college mid-way through. This significantly affected my GPA and the amount of courses I've actually completed. As such, I didn't attend the career fair that took place at my university. A mistake most likely, though I knew I didn't have a chance with any companies. This also means I probably won't be able to switch majors for at least two more semesters, in order to pull my GPA up.   Currently I know a bit of Python and Java, the basics of C#, and was just starting to learn C++ when I had the conversation with my professor. I kind of feel as if I should focus on either C# or C++ for developing my own games. I think the games would go along nicely with school projects as things I could show off to potential employers.     So, my questions to you guys.   What would you recommend for me moving forward with college? I may change and want to enter the Game Dev industry, but that's not something I can answer now. I don't know how a Comp Math degree would look or what I would be expected to have knowledge of or work on in games. I'm interested in AI, so I think it may be a fit. Right now, I'm not interested in low level systems, though again anything may change.   I also think it would be pertinent to have a personal website. I don't have any web skills, and am not really interested in web design particularly. As such, it seems it would be best if I went with a website or something that has prebuilt templates and such. Easier and automated content creation. Can anyone recommend something like this?   Would you recommend one language over another for working in mainly for now? If so, what tools are available as benefits?
  14. C++ IDE/Compiler

    I'm actually decently proficient with C#/Java/Python, so I'm definitely comfortable with a lot of concepts.   Like I said, I'm delving into C++, not general programming.   And thanks for the advice!
  15. Hello all!   I'm beginning to delve into C++, and recently ordered this book (due to arrive Wednesday, the 28th). I realize that C++11 has some of the latest and greatest features, and would definitely like to start with that as a base, unless completely recommended against.   I have access to VS2012 and 2013 (Up to and including Ultimate) through the Dreamspark program. I'm also not afraid of installing any Linux distros if that would be better suited for accessing C++11 features.    I know VS2012 doesn't support all the new features (and I don't think any compilers really do all the features, yet). When I tried googling, I couldn't find anything really mentioning VS2013's support for it that also compared to other IDEs and compiler.   I'm looking for any recommendations on how to proceed here. What do you use for your IDE/Compiler?   Thanks!