• What do you need help with? V. 3.0
    4,884 replies, posted
[QUOTE=sim642;32003874]It's a bit ugly since the names returned are dependent to the compiler. I guess I'll have to use those wierd names in my program then.[/QUOTE] You can also do typeid( MyClass ).
Anyone know the best way to render a huge array of ASCII characters in a grid, dwarf fortress style?
What platform / rendering library? In xna i'd just spritebatch it.
I'm reading through a book on assembly language, and there is a questions section at the end of every chapter. There is not, however, an answers section. So, I have a quick question about one of the questions. It asks: What does the instruction incl record_buffer + RECORD_AGE do? What addressing mode is it using? How many operands does the incl instructions have in this case? Which parts are being handled by the assembler and which parts are being handled when the program is run? In the code, record_buffer is defined in .bss to be of size RECORD_SIZE which is a constant defined as 324. RECORD_AGE is another constant defined to be 320. Would the instruction increment the word that is 320 bytes into the buffer by one? And would it be direct addressing mode because the compiler would take care of combining the constants, so when run it would just be treated as a single memory address? And so incl would only be accepting one operand? There is a similar example to this earlier on in the book where a similar line is explained in this way, but the buffer is prefixed with $. This would cause it to be interpreted as the literal number of the first address of the buffer instead of the byte found at that address, which doesn't make sense because you can't increment a literal value(which is why I assume the $ is not present in the question) Sorry if that got confusing but writing this all out is helping me understand it myself, and if I'm wrong I hope someone will correct me.
[QUOTE=ScreenNamesSuck;32014502]Anyone know the best way to render a huge array of ASCII characters in a grid, dwarf fortress style?[/QUOTE] Use a library like curses.
I'm feeling pretty damn noob at the moment, I'm not liking it. Anyways, it's like the 2nd "proper" time I've decided to do something in Eclipse, and I wanted to check out Notch's source code for his Ludem Dare game, which is here: [url]https://s3.amazonaws.com/ld48/PoC_source.zip[/url] I opened up Eclipse, went to File > New > Java Project, and selected the directory of the game's source. Everything went sweet, and I clicked the debug button but I'm getting some errors. I know they have something to do with the directories of the texture files (maybe the game can't find them or some shit)... here's a screenie: [thumb]http://dl.dropbox.com/u/12453703/javafuk.PNG[/thumb] I tried slapping the tex folder in the same folder as Art.java but that didn't work out... I don't know what's supposed to happen - am I meant to do something with my project directories or something? :v:
[QUOTE=Chrispy_645;32017597]I'm feeling pretty damn noob at the moment, I'm not liking it. Anyways, it's like the 2nd "proper" time I've decided to do something in Eclipse, and I wanted to check out Notch's source code for his Ludem Dare game, which is here: [url]https://s3.amazonaws.com/ld48/PoC_source.zip[/url] I opened up Eclipse, went to File > New > Java Project, and selected the directory of the game's source. Everything went sweet, and I clicked the debug button but I'm getting some errors. I know they have something to do with the directories of the texture files (maybe the game can't find them or some shit)... here's a screenie: [thumb]http://dl.dropbox.com/u/12453703/javafuk.PNG[/thumb] I tried slapping the tex folder in the same folder as Art.java but that didn't work out... I don't know what's supposed to happen - am I meant to do something with my project directories or something? :v:[/QUOTE] Does he use JDK 6 or 7?
Hey guys just a quicky: I've got a multidimensional array in one class and I want to pass it trough a function to a pointer in another class, like this: [code] class herp { int array[20][20]; int *getArray() { return &array; } }; class derp { int *pointer[20]; pointer = pointertoherpclass->getArray(); }[/code] But I can't remember how to pass a multidimensional array like this anyone able to help me?
[QUOTE=FPSMango;32021130]Hey guys just a quicky: I've got a multidimensional array in one class and I want to pass it trough a function to a pointer in another class, like this: [code] class herp { int array[20][20]; int *getArray() { return &array; } }; class derp { int *pointer[20]; pointer = pointertoherpclass->getArray(); }[/code] But I can't remember how to pass a multidimensional array like this anyone able to help me?[/QUOTE] You can't directly assign it to the array of pointers, because they don't work in the same way a multidimensional array works. A multidimensional array just stores it's data in a singledimensional array, but does the conversion from multidimensional indexes and singledimensional indexes for you. The other one is just an array of pointers :v: So you'd have to convert it to that first.
[QUOTE=FPSMango;32021130]Hey guys just a quicky: I've got a multidimensional array in one class and I want to pass it trough a function to a pointer in another class, like this: [code] class herp { int array[20][20]; int *getArray() { return &array; } }; class derp { int *pointer[20]; pointer = pointertoherpclass->getArray(); }[/code] But I can't remember how to pass a multidimensional array like this anyone able to help me?[/QUOTE] You don't need the ampersand to get the address. Arrays are themselves pointers to memory. All the array notation is just syntactic sugar for pointer operations.
[QUOTE=ROBO_DONUT;32021665]Arrays are themselves pointers to memory.[/QUOTE] Strictly speaking, not quite. Arrays are distinct from pointers, but an array automatically "decays" into a pointer when it's used like one. The difference is that arrays have a size as part of their type: int[2] and int[3] are distinct types even though they both decay into int*. (An unsized array type, like int[], appearing in a function's argument list, basically is just a pointer though.)
When I try to compile this code: [cpp] #include <SFML/Graphics.hpp> int main() { sf::RenderWindow window( sf::VideoMode(800,600), "SFML Graphics" ); sf::Font font; if (!font.LoadFromFile("arial.ttf")) { return EXIT_FAILURE; } sf::Text text; text.SetFont(font); text.SetCharacterSize(30); text.SetStyle(sf::Text::Regular); while (window.IsOpened()) { sf::Event event; while( window.PollEvent(event) ) { if(event.Type == sf::Event::Closed) window.Close(); } window.Clear(); window.Draw(text); window.Display(); } return EXIT_SUCCESS; } [/cpp] The small debug console would say "Failed to load font "arial.ttf"Failed to create the font face" and another window opens and closes without displaying anything. I'm using a snapshot of SFML2 and using Visual C++ 2010 express edition to compile.
SFML doesnt load fonts from the system folder, you need to have the font file with your project
[QUOTE=Richy19;32022107]SFML doesnt load fonts from the system folder, you need to have the font file with your project[/QUOTE] Okay, thanks.
[QUOTE=Exosel;32022159]Okay, thanks.[/QUOTE] You can always use sf::Font::GetDefaultFont() or what was it.
[QUOTE=Exosel;32022159]Okay, thanks.[/QUOTE] What I did was just grab a bunch of free fonts and I just use those. [url]http://www.1001freefonts.com/[/url] [url]http://www.urbanfonts.com/[/url]
I'm a fairly new C# native with some C++ experience looking to get more experience developing games in C++. I'm planning on working with OpenGL and Bullet Physics, but I'm not a complete expert at 3D programming. I'm willing to shell out some cash for a handy textbook; is the 5th edition superbible pretty much the de facto guide for newbs and intermediates or should I get something simpler? I understand enough about 3d programming to get what shaders are for, what SRT implies, and the difference between a world, view, and projection matrix. I'm mostly just interested in getting better at working in C++ and furthering my 3D skills.
[QUOTE=Dragonsdoom;32023960]I'm a fairly new C# native with some C++ experience looking to get more experience developing games in C++. I'm planning on working with OpenGL and Bullet Physics, but I'm not a complete expert at 3D programming. I'm willing to shell out some cash for a handy textbook; is the 5th edition superbible pretty much the de facto guide for newbs and intermediates or should I get something simpler? I understand enough about 3d programming to get what shaders are for, what SRT implies, and the difference between a world, view, and projection matrix. I'm mostly just interested in getting better at working in C++ and furthering my 3D skills.[/QUOTE] Well to be honest if you already get most of the theory behind 3D you should just use a website tutorial that shows you the code for it. No need to get the book
I disagree, I don't think the purpose of the [b]OpenGL[/b] superbible is merely to teach you 3D programming theory. It's to teach the ins and outs of OpenGL, for which it's a great resource. I'll admit, I'm more of an online tutorial guy, but that's beside the point.
[QUOTE=Hypershadsy;32019017]Does he use JDK 6 or 7?[/QUOTE] No fekkin' idea. I'll try play around with setting up a project again from scratch when I get back home. =/
[QUOTE=sim642;32022278]You can always use sf::Font::GetDefaultFont() or what was it.[/QUOTE] [QUOTE=ief014;32022296]What I did was just grab a bunch of free fonts and I just use those. [url]http://www.1001freefonts.com/[/url] [url]http://www.urbanfonts.com/[/url][/QUOTE] Thanks.
Hm, what would be a good 2D api for java? I am looking into Java 2D, but to me it just seems old by the tutorials I have looked at, even at Oracle's page. Mentioning stuff like Java 2, when we are on 6. Thanks in advance.
[QUOTE=IAmAnooB;32034833]Hm, what would be a good 2D api for java? I am looking into Java 2D, but to me it just seems old by the tutorials I have looked at, even at Oracle's page. Mentioning stuff like Java 2, when we are on 6. Thanks in advance.[/QUOTE] slick
[QUOTE=Richy19;32035094]slick[/QUOTE] Thanks, I will look into to it.
Need some help bad Im using SFML with openGL and when I use an image and draw it I get weird things here is what valgrind says [code] valgrind ./SFMLTest ==6759== Memcheck, a memory error detector ==6759== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==6759== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==6759== Command: ./SFMLTest ==6759== ==6759== Invalid read of size 4 ==6759== at 0x463498A: ??? (in /usr/lib/dri/i965_dri.so) ==6759== by 0x4612437: ??? (in /usr/lib/dri/i965_dri.so) ==6759== by 0x4592997: ??? (in /usr/lib/dri/i965_dri.so) ==6759== by 0x4586AD7: ??? (in /usr/lib/dri/i965_dri.so) ==6759== by 0x45853ECC: ??? (in /usr/lib/libGL.so.1.2) ==6759== by 0x4582D050: glXMakeContextCurrent (in /usr/lib/libGL.so.1.2) ==6759== by 0x4582D1D3: glXMakeCurrent (in /usr/lib/libGL.so.1.2) ==6759== by 0x43D46412: (below main) (in /lib/libc-2.14.so) ==6759== Address 0x4200db8 is 0 bytes inside a block of size 1 alloc'd ==6759== at 0x4005447: calloc (vg_replace_malloc.c:467) ==6759== by 0x4634B57: ??? (in /usr/lib/dri/i965_dri.so) ==6759== by 0x4612437: ??? (in /usr/lib/dri/i965_dri.so) ==6759== by 0x4592997: ??? (in /usr/lib/dri/i965_dri.so) ==6759== by 0x4586AD7: ??? (in /usr/lib/dri/i965_dri.so) ==6759== by 0x45853ECC: ??? (in /usr/lib/libGL.so.1.2) ==6759== by 0x4582D050: glXMakeContextCurrent (in /usr/lib/libGL.so.1.2) ==6759== by 0x4582D1D3: glXMakeCurrent (in /usr/lib/libGL.so.1.2) ==6759== by 0x43D46412: (below main) (in /lib/libc-2.14.so) ==6759== Using OpenGL 2.1 Using GLEW 1.5.8 ==6759== Conditional jump or move depends on uninitialised value(s) ==6759== at 0x4049DFA: sf::Renderer::SetShader(sf::Shader const*) (in /usr/local/lib/libsfml-graphics.so.2.0) ==6759== by 0x4395FFFF: ??? ==6759== ==6759== Conditional jump or move depends on uninitialised value(s) ==6759== at 0x4049C28: sf::Renderer::SetBlendMode(sf::Blend::Mode) (in /usr/local/lib/libsfml-graphics.so.2.0) ==6759== by 0x4395FFFF: ??? ==6759== ==6759== Conditional jump or move depends on uninitialised value(s) ==6759== at 0x4049D48: sf::Renderer::SetTexture(sf::Texture const*) (in /usr/local/lib/libsfml-graphics.so.2.0) ==6759== by 0x404F191: sf::Sprite::Render(sf::RenderTarget&, sf::Renderer&) const (in /usr/local/lib/libsfml-graphics.so.2.0) ==6759== by 0x4033F57: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/local/lib/libsfml-graphics.so.2.0) ==6759== by 0x4395FFFF: ??? ==6759== ==6759== ==6759== HEAP SUMMARY: ==6759== in use at exit: 76,889,591 bytes in 3,567 blocks ==6759== total heap usage: 9,108 allocs, 5,541 frees, 87,541,436 bytes allocated ==6759== ==6759== LEAK SUMMARY: ==6759== definitely lost: 1,240 bytes in 10 blocks ==6759== indirectly lost: 0 bytes in 0 blocks ==6759== possibly lost: 22,336,180 bytes in 14 blocks ==6759== still reachable: 54,552,171 bytes in 3,543 blocks ==6759== suppressed: 0 bytes in 0 blocks ==6759== Rerun with --leak-check=full to see details of leaked memory ==6759== ==6759== For counts of detected and suppressed errors, rerun with: -v ==6759== Use --track-origins=yes to see where uninitialised values come from ==6759== ERROR SUMMARY: 6 errors from 4 contexts (suppressed: 66 from 14)[/code] It opens and displays the Using OpenGL 2.1 Using GLEW 1.5.8 And after 1 or 2 seconds it crashes and closes Displaying this [img]http://i.imgur.com/MmL1R.png[/img] As you see the window does get created but because it doesnt draw it just displays what was behind it
So I'm still working on my 3d engine that I'm creating from scratch and I just had an attempt at getting the mouse to rotate my camera. Well, it 'kinda' works. This is the code that I use: [code] glm::vec2 cursorpos = mouse.GetMousePos(); GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); Camera.AddYaw( ( cursorpos.x - (viewport[2] / 2) ) * 0.1f ); mouse.SetMousePos( glm::vec2( viewport[2] / 2, viewport[3] / 2 ) ); [/code] This works, that if I just move my mouse from side to side the camera rotates too. However, it has these weird spikes that happens quite often. If I just keep slowly moving my mouse, all of a sudden it will spike quickly and rotate the camera QUITE a distance. Usually so much that it practically makes a 180 degree turn. My question is, what causes this? I've tried multiplying it by deltatime, changing that 0.1f constant etc... I really can't figure out what causes this. Help? I uploaded the .exe here if anybody wants to see my problem: [url]http://www.2shared.com/file/6DbFQnsA/Release.html?[/url] You can move the mouse left & right to rotate the camera, or you can use the arrow keys to rotate the camera to the sides or up and down. In there, there's 2 blue rectangles. You'll see them if you press left arrow a couple of times. By the way, I am quite aware of the fact that escape can't close it etc. Use alt+f4 to close it. Perhaps anyone can direct me towards a tutorial / article about mouse input?
Mind showing the code, not the errors?
[QUOTE=Jookia;32044891]Mind showing the code, not the errors?[/QUOTE] Me or him? [editline]31st August 2011[/editline] If you mean me then: header for the title [cpp] #ifndef TITLESCREEN_HPP_INCLUDED #define TITLESCREEN_HPP_INCLUDED #include <SFML/Graphics.hpp> #include <string> class TitleScreen { sf::Texture titleImage; sf::Sprite titleSprite; sf::Text TitleText; sf::Text NewGameText; sf::Text OptionsText; sf::Text QuitText; sf::Font font; public: TitleScreen(); ~TitleScreen(); unsigned char Draw(sf::RenderWindow &App); }; #endif // TITLESCREEN_HPP_INCLUDED [/cpp] source [cpp] #include "TitleScreen.hpp" #include "CubeTexture.h" TitleScreen::TitleScreen() { font.LoadFromFile( "./data/gomarice_mousou_record.ttf" ); TitleText = sf::Text("FUCKING WORK ALREADY", font, 80); NewGameText = sf::Text("New Game", font, 60); OptionsText = sf::Text("Options", font, 60); QuitText = sf::Text("Quit", font, 60); titleImage.LoadFromFile("./data/Title.png");//Memory(CubeTexture_png, sizeof(CubeTexture_png) ); //titleImage.SetSmooth(true); titleSprite = sf::Sprite( titleImage ); titleSprite.SetPosition(0.0f,0.0f); TitleText.SetColor(sf::Color::Black); NewGameText.SetColor(sf::Color::Black); OptionsText.SetColor(sf::Color::Black); QuitText.SetColor(sf::Color::Black); TitleText.SetOrigin(TitleText.GetRect().Width / 2, TitleText.GetRect().Height / 2); NewGameText.SetOrigin(NewGameText.GetRect().Width / 2, NewGameText.GetRect().Height / 2); OptionsText.SetOrigin(OptionsText.GetRect().Width / 2, OptionsText.GetRect().Height / 2); QuitText.SetOrigin(QuitText.GetRect().Width / 2, QuitText.GetRect().Height / 2); TitleText.SetPosition(400, 40); NewGameText.SetPosition(400 , 120); OptionsText.SetPosition(400 , 200); QuitText.SetPosition(400 , 280); } TitleScreen::~TitleScreen() {} unsigned char TitleScreen::Draw(sf::RenderWindow &App) { unsigned char result = 0; if(sf::Mouse::IsButtonPressed(sf::Mouse::Left)) { if(QuitText.GetRect().Contains( sf::Mouse::GetPosition(App).x, sf::Mouse::GetPosition(App).y )) { result = 255; } else if(OptionsText.GetRect().Contains( sf::Mouse::GetPosition(App).x, sf::Mouse::GetPosition(App).y )) { result = 250; } else if(NewGameText.GetRect().Contains( sf::Mouse::GetPosition(App).x, sf::Mouse::GetPosition(App).y )) { result = 245; } } App.Draw( titleSprite ); App.Draw( TitleText ); App.Draw( NewGameText ); App.Draw( OptionsText ); App.Draw( QuitText ); return result; } [/cpp] and I call it [cpp]case menu: { App.SaveGLStates(); App.ShowMouseCursor(true); if(currView == winView) App.SetView(sf::View(sf::FloatRect(0,0, smView.x, smView.y)) ); unsigned char result = titleScreen.Draw(App); if(result == 255) gameStage = quit; if(result == 250) gameStage = options; if(result == 245) gameStage = game; App.RestoreGLStates (); break; }[/cpp]
I hope I've posted this in the right place. My apologies if I haven't. Right, my issue is with env_projectedtexture. In order to have multiple env_projectedtextures working at once, i edited the clientshadowmgr.cpp file (line 1293), to read: m_nMaxDepthTextureShadows = 15 I compile the solution with Visual C++ 2005, with no errors, I then compile the map, but then, in the console, I get the error "too many shadow maps in this frame". As far as I can tell, it's nothing to do with the compile log, as that runs smoothly, with no errors whatsoever. What am I doing wrong? I followed the tutorial from the developer community wiki precisely, yet it doesn't work...
I've got a fairly simple problem, I'm trying to draw a sort of health/progress bar by rendering part of a sprite. [code]spriteBatch.Draw(barFront, player.isoPos + new Vector2(-32, 35) - viewPos, new Rectangle(0, 0, 48*(pickupCount/treeController[controlId].trees[treeId].pickupTime), 7), Color.White, 0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 1f);[/code] For some reason it doesn't draw it at all until pickupCount is equal to pickupTime, which is only for a split second. What have I done wrong?
Sorry, you need to Log In to post a reply to this thread.