I'm using fstream to read words from a file and I can't just read the whole word like so: ifstream ob("file.txt"); string word; ob >> word; But I need to somehow specify to read 20 positions, even though there might be just spaces included. So I was trying to do something like this: ifstream ob("file.txt"); char word[20]; ob.read(word, 20); but when I cout this everything seem to be normal except the last element (word[20]) is some kind of a weird symbol, here's an example of what I mean: [click](http://postimage.org/image/oloyfljbr/)

Member Avatar
Member Avatar
+0 forum 4

I'm using the Guichan lib and I was trying to run the "First application with Guichan, OpenGL and SDL" example, which is located here [Click Here](http://guichan.sourceforge.net/oldsite/getting-started.shtml) . Everything was fine exept when I exit the program and delete all the pointers which were allocated with the "new" and because of this deletion I get an unhandled exeption/acces violation error. Note that I dont follow that example to the last line, but it should still be okay, I do the allocation in the constructor and deallocation in the destructor etc. I noticed that the same happens even if I run the …

Member Avatar
Member Avatar
+0 forum 3

I need to use forms, widgets etc. in my program which already takes care of creating a window and such. So the question is, would it be okay to use Windows lib to add the needed features, such as a form with a few widgets without any errors, memory leaks and such, cuz if I recall corretctly, when creating a window using Windows lib you would need to do some things to clean everything up afterwards, does the same apply to what I want to do (just for forms, widgets)?

Member Avatar
Member Avatar
+0 forum 4

To be specific I'm trying to implement this into a small game. What I'm thinking of is having a base/default class for derived objects such as player, enemies, tiles and so on and later the derived classes would inherit this base class and add whatever is needed depending on the object. Right now the base class contains all the basic variables needed and all the basic virtual functions. I'm thinking of making that the base class would have a constructor and parameters to initialize all the default variables and the derived class would add anything if needed in its own …

Member Avatar
Member Avatar
+0 forum 1

So I was trying out SDL_gfx lib and tryed using the rotozoomSurface() [Click Here](http://www.ferzkopp.net/Software/SDL_gfx-2.0/Docs/html/_s_d_l__rotozoom_8h.html#a3cb0c11d5edc929579c807dc7612348c) which should've rotated my surface at runtime, but it seems that whenever I do that my surface turns invisible. It doesn't matter if I predefine the rotation or use it at runtime, the same happens, I've tryed using the other rotation functions, still the same. Any info on this? SDL_Surface* rot = rotozoomSurface(surface[0], 10, 1, 0); surface[0] = rot; SDL_FreeSurface(rot); Later I blit the surface[0] as usual. Note that without the code above the surface blits perfectly.

Member Avatar
Member Avatar
+0 forum 6

Maybe I'm just missing something but I was thinking what do you call something like a Windows Form Application in Visual Studio where you can drag and drop and stuff like that. Do you call that an API or SDK or GUI or something else? By the way, as I understand that Windows Form Application that I'm talking about is actually Visual Basic, correct me if I'm wrong. And if it possible to create applications by mostly drag and droping why use something like Win32 API?

Member Avatar
Member Avatar
+0 forum 1

I had this talk with a friend a while back and now i remmember that he said that C# is like a newer version of C++, but i think thats not correct, since C, C++, C# is kinda all oriented in this or that, what do you guys think of it?

Member Avatar
Member Avatar
+0 forum 7

I have no working experience but i do have some knowledge in programming and web development. Note that i cant work at a company or such right now so i think freelancing is the best choise for me. I think it's much better to list what kind of projects and such i've done in the past: Some games using libs like SDL, Started out with opengl, Some simple Win32 API apps like String/Bit/Hex encoder/decoder Some web development with PHP/HTML/CSS/JQUERY, making a few basic webs for myself and editing templates to make it look how i wanted to. And of course …

Member Avatar
Member Avatar
+0 forum 3

I was just wondering why do we exactly call glTranste command if its possible just to increase objects x, y or z. And its even stated in this tutorial: http://nehe.gamedev.net/tutorial/particle_engine_using_triangle_strips/21001/ that its even faster to only use Vertex3f() instead of resetting the Modelview Matrix. Anyways, maybe its just something particular in this tutorial why we do exactly that or something similar, but i would like to know more.

Member Avatar
Member Avatar
+0 forum 5

Just wanted to know if we need to texture map the texture on the model with code or is it better to just import a model with textures already on him? (considering its even possible)

Member Avatar
Member Avatar
+0 forum 1

So i was simply following one of the opengl tutorials - http://nehe.gamedev.net/tutorial/loading_and_moving_through_a_3d_world/22003/ So everything works completely fine except one thing, when i load in textures with SOIL lib its not completely correct, but with GLAUX lib it works just fine but i dont prefer using GLAUX. Here is what i mean: with GLAUX - http://postimage.org/image/rz6lxzo9b/ with SOIL - http://postimage.org/image/4eg27jf0j/ Texture loading code with GLAUX (Dont mind the different filtering here): AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image { FILE *File=NULL; // File Handle if (!Filename) // Make Sure A Filename Was Given { return NULL; // If Not Return …

Member Avatar
+0 forum 0

It seems that i dont fully comprehend how rotation works. So leys say i have a cube and i do this: x = 90.0f; rotatef(x, 1.0f, 0.0f, 0.0f); Notice that my code here may be not all correct, its like that just to symbolize what i mean. So by doing that i would be facing the Top of the cube. But in this tutorial: http://nehe.gamedev.net/tutorial/moving_bitmaps_in_3d_space/17001/ it states that by doing something like that, its like rotating the whole room so now X axis goes out or into the screen and Z axis is right or left. So its basically the …

Member Avatar
Member Avatar
+0 forum 10

Straight to the point, I am using SOIL (http://www.lonesock.net/soil.html) library to upload images into OpenGl. Loading textures works fine but there is this thing i dont fully comprehend. Lets say I load an image into OpenGL via SOIL and I want to reuse the same image over few other textures so I would not load any more images to save memory. So without SOIL I would do something like this: `glGenTextures(3, &texture[0]);` thus generating 3 textures from 1 image i uploaded into texture[0]. But with SOIL to upload an image I need to use this: texture[0] = SOIL_load_OGL_texture( "0.bmp", SOIL_LOAD_AUTO, …

Member Avatar
Member Avatar
+0 forum 4

So the function: [CODE]glLoadIdentity();[/CODE] resets the matrix, so for instance we do this: [CODE]glMatrixMode(GL_PROJECTION); glLoadIdentity();[/CODE] how exactly does this work, it seems that we set the matrix and then just return it to the way it used to be.

Member Avatar
Member Avatar
+0 forum 1

Example code: [CODE]HWND CreateButton(const HWND hParent,const HINSTANCE hInst,DWORD dwStyle, const RECT& rc,const int id,const ustring& caption) { dwStyle|=WS_CHILD|WS_VISIBLE; return CreateWindowEx(0, _T("button"), caption.c_str(), dwStyle, rc.left, rc.top, rc.right, rc.bottom, hParent, reinterpret_cast<HMENU>(static_cast<INT_PTR>(id)), hInst, 0); }[/CODE] The part I dont get is: [CODE]dwStyle|=WS_CHILD|WS_VISIBLE;[/CODE] So the question would be why do we use '|' and whats it for? I've seen it being used in many other places, doest it even belong to C++? Something like '||' is obvious but cant figure out '|'.

Member Avatar
Member Avatar
+0 forum 7

I'm trying to use Box2D lib with SDL lib. NOTE that I only get the errors below after I link in SDL too. I think i link everything accordingly but in the end when I write up some code i get errors like: 1>------ Build started: Project: box2d test2, Configuration: Debug Win32 ------ 1> main.cpp 1>Box2D.lib(b2PolygonShape.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in main.obj 1>Box2D.lib(b2BlockAllocator.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in main.obj 1>Box2D.lib(b2Settings.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value …

Member Avatar
Member Avatar
+0 forum 5

[B]On visual studio 10:[/B] I've tryed out some code and everything was fine, but when I use this line: [CODE]sf::RenderWindow App( sf::VideoMode ( 800, 600, 32 ), "Hexagon Puzzle Thing" );[/CODE] Or anything with RenderWindow I get an: Unhandled exception at 0x76adfeb8 in SFML + Box2D Project.exe: 0xC0000005: Access violation reading location 0xcccccccc. Code I'm using: [CODE]#include <SFML/Graphics.hpp> int main() { sf::RenderWindow App( sf::VideoMode ( 800, 600, 32 ), "Hexagon Puzzle Thing" ); while( App.IsOpened() ) { sf::Event Event; while( App.GetEvent( Event )) { if( Event.Type == sf::Event::Closed ) App.Close(); } App.Draw( sf::Shape::Rectangle( 350, 200, 600, 350, sf::Color::Green )); App.Display(); …

Member Avatar
+0 forum 0

Hi, just wanted to share what I've been doing and ask for some friendly/unfriendly advice :) . Some time ago I've started out with C++, learned the basics and stuff. Then I took up SDL, learned the basics and stuff too, made a few bigger/smaller projects and just recently I've moved to OpenGL and at this point I'm just thinking if its really a way to go. Ofcourse it depends on me, I enjoy making games, but I thought that I wasnt actually going deeper into C++ itself, the basics were enough ( at my level atleast ) and thought …

Member Avatar
Member Avatar
+0 forum 1

I'm using SDL to make a game and I'm using frame independent movement, everything works fine with no gravity or acceleration: [CODE]boxOffsetY += yVel * ( DELTA.get_ticks() / 1000.f );[/CODE] The box moves accordingly, no matter what frame rate i use. But when i try to add gravity: [CODE]yVel += dropSpeed * ( DELTA.get_ticks() / 1000.f );[/CODE] I add this line first. [CODE]boxOffsetY += yVel * ( DELTA.get_ticks() / 1000.f );[/CODE] And just like before I add this line later. I've tried various methods but none of them seem to work properly. Doing this based on Lazy Foo's tutorial: [url]http://lazyfoo.net/SDL_tutorials/lesson32/index.php[/url]

Member Avatar
Member Avatar
+0 forum 6

Hi, I would like to get an advice, lets take SDL lib as an example. Recently I've been declaring sprite sheets that certain classes use ( player, enemy... ) globally and thought that a better way would be to load sprite sheets inside a class thats using it but if lets say i create like 100 class objects at the same time, it would take up a lot more memory and every time the constructor would have more work ( loading the sprite, clipping it... ), could someone point me to the right direction on this one.

Member Avatar
Member Avatar
+0 forum 1

Theres this thing that i dont fully understand. Im using this tutorial: [url]http://lazyfoo.net/SDL_tutorials/lesson08/index.php[/url] and i in here we first set up some surfaces with text and then asign their value to the message and then for some reason we have to reset the message value to 0 in order for the program to quit properly, but if i dont set up the surfaces with text from the start and just set up the message myself when coding the event itself, i dont need to reset it and everything works just fine, whats the deal? I think i wasnt very clear …

Member Avatar
Member Avatar
+0 forum 49

Trying to do some basic "Game of life", but for some reason i'm getting some weird results, the code: [CODE]#include "stdafx.h" #include "stdlib.h" #include <iostream> using namespace std; #include "windows.h" const int V=30;//Vertical const int H=40;//Horizontal char A[V][H]; int ne=0; //Set all to dead void setDead() { for (int i=0;i<V;++i) { for (int j=0;j<H;++j) { A[i][j]='-'; } } } //Print void print() { system("cls"); for (int i=0;i<V;++i) { for (int j=0;j<H;++j) { cout<< A[i][j]; } cout<< endl; } } //Enter alive cells void enter() { int h=0,v=0; bool status=false; while(true) { cout<< "Enter Vertical: "; cin>> v; cout<< "Enter Horizontal: …

Member Avatar
Member Avatar
+0 forum 5

I was watching a tutorial that says that we first need to check if any direction key was pressed, and only then we check which key was pressed, like this: [CODE]while( running == true ) { while( SDL_PollEvent(&event) ) { if ( event.type == SDL_KEYDOWN ) //checking if any key was pressed { switch( event.key.keysym.sym ) //checking for specific { case SDLK_UP: yC -= 10; break; // yC -coordinates of a surface case SDLK_DOWN: yC +=10; break; } } else if ( event.type == SDL_QUIT ) { running = false; } }[/CODE] But then i tried to do it wihouth …

Member Avatar
Member Avatar
+0 forum 1

So i just started learning SDL and came across "Event driven programming", just wanted to be sure if i understood the tutorial correcly. So lets say by adding: [CODE]SDL_Event event;[/CODE] i add lets say a container that keeps track of every event i do? After that i start using: [CODE]while ( program == true ) { while(SDL_PollEvent(&event) { if ( event.type == SDL_QUIT ) { program = false; } } }[/CODE] If i understand correcly, in the second loop we say that while theres some sort of event ( and we send a list of events ) do the loop …

Member Avatar
Member Avatar
+0 forum 2

Hello everyone. Im a total noob at programming and thought i could join a community with the same interests. Right now i'm trying to get something done with C++ and im into Pascal too for school reasons. I only scratched the C++ so i expect to get some answers if needed and i hope to help anyone in need in the future. ;)

Member Avatar
Member Avatar
+0 forum 1

Its something really basic, but for some reason i cant get my dinamic array to work. Keep getting a message that i need to add the "[]", but then i would create a static array, not a dinamic one. The code: [CODE]program Noname0; var arr : array of integer; begin WriteLn('Hi!'); Readln; end.[/CODE]

Member Avatar
Member Avatar
+0 forum 3

Just recently started learning SDL and have this problem, this program should properly display my background and message on the screen, but instead its just a black screen. Did the Blit, did the Flip, maybe im missing something? Heres the code: P.S i know i might forgot to add some simple line or something, but i just cant find it ^^ [CODE]#include <SDL.h> #include <string> SDL_Surface* Load_image(std::string filename) { SDL_Surface* loadedimage = 0; SDL_Surface* optimizedimage = 0; loadedimage = SDL_LoadBMP(filename.c_str()); if ( loadedimage != 0 ) { SDL_Surface* optimizedimage = SDL_DisplayFormat(loadedimage); SDL_FreeSurface(loadedimage); } return optimizedimage; } void apply_surface(int x,int y, …

Member Avatar
Member Avatar
+0 forum 2

Hello. First of all i know that this was asked like a million times, but i just cant get the right answer anywhere, yes, even on google. So the thing is that i learned the C++ basics and my learning process was only in a Console Application. And now for a while im just bouncing from one thing to another and it seems that im doing something wrong. The question is, what to do now? I tried using libs but some of them seemed to do all the work for me, the others seemed to be too complicated. Well, i …

Member Avatar
Member Avatar
+0 forum 6

The End.