C :: Getting Started On Rogue Using Ncurses Library

Feb 16, 2013

I've been assigned to program rogue using the ncurses library, which will need

1. File I/O
2. String parsing
3. User input (h,j,k,l)
4. Room drawing

And Where i can start with this program?

View 4 Replies


ADVERTISEMENT

C/C++ :: Getting Started With Contour Plots

Oct 23, 2014

I'm new to C++ programming and only have a little java experience but I'm trying to learn some C++. I want to create a simple contour plot from scratch, and I see that there are many programs online, but what I haven't found are the basic components to a contour plot! I know that I have to make some kind of grid, I need to identify/set levels, etc.

View 9 Replies View Related

C++ :: Change Process Name When Program Started?

Jan 27, 2014

1. I want to do 2 while at the same moment. Exactly I want one while which is checking the time and it should di something every X second and the other should check something parallel.

2. How i can write the program what i write automaticly into the autorun on every windows pc.

3. Can i change the process-name when the programm started?

4. Can i save my .exe under another name in the autorun

View 3 Replies View Related

C++ :: Rogue Like Item Creationg And Optimization

Mar 8, 2013

I'm creating a roguelike/ cave exploration game, and I've created a lot of it, but I am having problems with item creation. The item is supposed to be the '*'. I know what the problem is (I'm setting Dmap to map after creating the item, but before outputting Dmap), but I don't know how to fix it.Also, I don't really know how code optimization works.I'll split my code between this post and the comments:

#include <cstdlib>
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <stdio.h> /* printf, NULL */
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time *

[code].....

View 1 Replies View Related

C++ :: Create Randomly Generated Rooms Like In Rogue?

Mar 7, 2013

I've been trying to create a roguelike, and I was trying to create randomly generated rooms like in Rogue. I'm seperating my map array into sections and giving it a 50% chance of spawning a room, but right now it doesn't do anything but spawn solid rock. What am I doing wrong?

int MapSizeX = 100;
int MapSizeY = 100;
char map[100][100] = {};
char wall = 178;
int ViewDistance = 10;

[code]....

View 3 Replies View Related

C++ :: How To Start Using Ncurses

Sep 3, 2013

It's written here: URL....But those links don't work. I can't understand how to start programming using ncurses.

View 9 Replies View Related

C++ ::  NCurses Outputting Vectors

May 19, 2013

The following code works perfectly with "normal" C++

#include <iostream>
#include <vector>
int main() {
std::vector <std::string> hello {

[Code] ....

This prints "HELLO" on the screen. A function a bit more like NCurses is:

for (std::vector <std::string>::const_iterator it = hello.begin(); it != hello.end(); it++) {
std::string temp = *it;
std::cout << temp.c_str() << std::endl;
}

This still works with "normal" C++. Now, how do I get this working with NCurses? I tried

#include <curses.h>
#include <string>
#include <vector>
int main() {
initscr();

[Code] ....

But this just gives me an empty screen.

View 2 Replies View Related

C++ :: Adding Content To Window Using Ncurses

Aug 12, 2013

I'm makeing a card game with ncurses. I have all the card and player objects in order but i'm stuck trying to get the gui to work.

I'm using multiple windows for different players deck and pile. Now to the problem: I can get all the windows to show with borders in the console but i can't get any content printed in the windows and I rally can't see why!?

I have been reading the guide on [URL] but I don't get any further on the problem right now.

PS. the complete code incl. Makefile can be found at:
github.com/DanBrehmer/cardGame
#ifndef GUI_H
#define GUI_H
#include <ncurses.h>

[Code]....

View 3 Replies View Related

C++ :: Ncurses - Highlighting A Line Of Characters On Screen

Oct 25, 2013

I am writing a program using ncurses that needs a function to highlight a line of characters on the screen. I started writing this function that took the x & y coordinates of a character on the screen and the length of characters after that to highlight. Whilst doing this I noticed that if I highlighted the last character in a row (maxX-1 in my example) it highlighted that character (as expected), and if I highlighted just the character before that (maxX-2) it also works. But if I do both, it highlights the whole row/line. Also, if there are characters in those spaces other than the 'space' character it works too, but for my program I need to be able to highlight empty spaces as well.

To highlight I am using inch() to get the character and addch() to print it because I am using some alternate characters that chgat() replaces with normal characters.

#include <ncurses.h>
int main(){
initscr();
start_color();
use_default_colors();
curs_set(0);
noecho();

int maxX=0, maxY=0;

[Code] ....

View 3 Replies View Related

C++ :: Make Terminal Screen Bigger In NCurses Program?

Jun 29, 2013

I wanted to make the terminal screen bigger in my NCurses program. Let's say if the defaults are 25 LINES and 80 COLS, I want to set them to 40 LINES and 120 COLS.

I've tried resizing all windows, but that did not work, because the actual terminal (console) was not resized. Then I found functions resizeterm and newterm, but they did not work. As far as my understanding goes resizeterm only updates NCurses information with the current configuration, while the window itself is not actually modified.

NCurses man page wrote:The function resizeterm resizes the standard and current windows to the specified dimensions

If I haven't made myself clear ( I sometimes make a mess of things... ), another example would be that I want my program to be fullscreen when I start it. Is this possible? It should be, I found a fullscreen NCurses program once, but the code was too confusing for me to understand.

Having read about things like SIGWINCH, I assume you must define a method for resizing the terminal screen yourself, I don't know where to start?

View 11 Replies View Related

C++ :: Shared Library Vs Static Library?

Jan 17, 2014

I've been reading about libraries; How to make them, how to use them, the different types of libraries, etc..

When using a shared library, does the program require that library to be installed on the computer after the program has been compiled into an .exe?

Ie.. if somebody downloaded a "Helloworld.exe" that I had compiled on my computer using a shared library (that wasn't part of a standard operating system), would they also need that shared library on their computer for the program to run without errors?

and for Static Libraries, when I compile a program using a static library, does it include in the final binary only the functions of the library that are actually used, or does the compiler add in the entire library?

View 8 Replies View Related

C :: How To Install GMP Library

Feb 19, 2013

How do you install the gmp library.How do you use it?

View 11 Replies View Related

C++ :: GMP Library Memory

May 11, 2013

I'm trying out the gmp library by building a simple pi calculation program (original, I know!). On a million digits of Pi I've debugged the program and seem to have about a megabyte too much of memory at the end of the program (I start with around 250k before any allocation begins and end at around 1200).

int main(int argc, char *argv[]) {
//set a//
int digitsofpi =1000000;
mpf_set_default_prec(log2(10) *digitsofpi );

mpf_t a;
mpf_init (a);
mpf_set_ui (a,1);

[code].....

View 2 Replies View Related

C++ :: How To Set Bullet Library To GCC

Jul 11, 2013

I would like to set the bullet library to GCC. I downloaded source code of bullet but i don't know how to set that.

View 6 Replies View Related

C++ :: Using A Library Function?

May 9, 2013

I have been trying to find a way around the following:

I am using a library functor to solve the root of a non linear equation. It passes two doubles and the name of a function that contains the equation to be solved.

Its xtor and operator are

RootFind(double tL,double tR,double (*fn)(double t));

void operator()(double tL,doubleR,double (*fn)(double t));

I want to be able to send another variable to function fn; I don't know what the value of the variable will be ahead of time.

How do I get the library functor to take an extra variable in the function passed?

View 1 Replies View Related

C++ :: How To Use Library Opensteer

Nov 5, 2014

I use the library opensteer, but I do not know where you should start.

Opensteer is a library written in C ++. My problem is figuring out whether to create a blank project in visual studio and import the library or directly import the library.

View 2 Replies View Related

C++ :: UDP Socket Library On Linux

Jan 29, 2014

I'm attempting to write a little UDP socket library in c++ on linux so a user can just create a new instance of a UDPSocket class, specify destination ip and port, and just connect. Then the user should be able to call send() or receive() in any order they want.. and here I encounter a little problem..

Most of the tutorials for udp socket sending out there include a bind() call when you create your "server" that is supposed to receive data, but the code that send data does not need one. Because I also want my library to support unicast/broadcast/multicast, I have read that I need to set the socket option SO_REUSEADDR on my sockets (since multiple sockets will need to be connected to same destination IP/port for broadcast/multicast)

My question is.. do I need to create 2 socket handles per "UDPSocke in order to make this work? One for sending and one for receiving data? In my code when I try to work with only 1 socket, it is only able to receive stuff from itself on unicast.. Or should I just remove the SO_REUSEADDR when in unicast mode, then try to bind with both sockets, accept that the bind will only work on the 1st socket, and take it from there?

View 1 Replies View Related

C :: Graphic Library For Plots (2D And 3D)

Dec 28, 2014

Any common and good library for plots ? (2D and 3D)

View 1 Replies View Related

C :: Creating A Library Function

Jan 27, 2015

I want to create a C library function that i can directly call in my code from any .c file having main program.following are codes...code of library function "foo.c"

Code:

#include "foo.h"
int foo(int x) /* Function definition */ {
return x + 5;
} header file "foo.h"

Code:

#ifndef FOO_H_ /* Include guard */
#define FOO_H_
int foo(int x); /* An example function declaration */
}

[code]....

to use this i have to compile the file in below manner...

Code: gcc -o my_app main.c foo.c

My concern here is that i want to compile the main.c and use function without compiling foo.c with i.e.

Code: gcc -o my_app main.c

any user of this function should only compile his program and should be able to use the function, the foo.c file should remain hidden from him

my system is Linux 2.6.18-308.4.1.el5 #1 SMP Wed Mar 28 01:54:56 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

View 9 Replies View Related

C :: Static Library Linking

Oct 7, 2014

I am trying to refresh my memory here as I did some studies many years ago but the results elude me.Also todays c/c++ compilers may have better optimizations.Say I have a static library that includes three obj modules.Each of these object modules has a number of functions. These functions do not reference any other functions within the obj module.My main app links this library but only references one function from each of the object modules.

Question: Are the complete contents of each module linked into my main app or are todays linkers smart enough to just link the functions used?

View 4 Replies View Related

C :: Library For Loading Images In PNG?

Jan 29, 2015

What's the best performance library for loading images in PNG?

View 5 Replies View Related

C :: Using PlPlot Library In Code

Mar 8, 2013

I am in try to use PlPlot library (for plotting) in C with code::blocks IDE (ver 10.05) on windows-7 plateform. I downloaded "plplot-5.9.9.tar" and unzipped it. In documentation it is not very clear to me (I am not expert in using third party lib.), how this library can be used with code::blocks i.e. where I have to save the lib, what should be added in compiler and debugger settings etc. It also seems from document that "makefile" (linux type!!) is necessary for Windows also? I am also unaware of MSYS makefile generator (given on Wiki page) on windows?

View 2 Replies View Related

C :: How To Create A Library Using Xcode

Feb 2, 2013

I'm completely new to C, and I don't know how to create a library using Xcode.

View 5 Replies View Related

C++ :: Allegro5 Library Compilation

Feb 5, 2015

I have a problem with compiling the Allegro5 library:

"Cannot find allegro-5.0.10- monolith.mt"

source:

#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <cmath>
int main() {
al_init();
al_init_primitives_addon();
al_install_keyboard();
ALLEGRO_KEYBOARD_STATE klawiatura;

[Code] ....

View 1 Replies View Related

C++ :: List Library - How To Traverse Through A And B

Aug 22, 2013

I'm trying to make a list that contains other lists. I want to use the <list> library /not my own implementation/. Here is what I do:

list<list<int>> Lists; //I create the main list
list<int> A, B; //Then I create the other lists
//After I fill them with data I add them to the main list
Lists.push_back(A);
Lists.push_back(B);

The problem comes when I try to go through A and B. I make an iterator of the main list:

list<list<int>> Iter = Lists.begin();

Then I need to make an iterator to traverse through A and B. But I can't make it. I do this:

list<int> Iter2 = Iter.begin() //But the compiler says it is not possible

How can I traverse through A and B?

View 3 Replies View Related

C++ :: How To Use Regex Library To Use It In CLI Game

Jan 18, 2015

I want to use C++ regex library, to use it in my lil' CLI game. The aim is to create the template(not C++ template :)) for command(like "go north"). Then, if player writes anything that contains "go", and "north" appearing after that(examples: "go north" "please go north" "Let's go north!" "Princess, I insist that we go to the north") would all be interpreted as simple "go north". I have used a bit of regex in Linux system, but not this ECMAScript regex that C++ uses.I've checked in some online regex tester, that if I write: ".*go.*north.*" then anything I want will be matched; however, I'd like these to be specifically separated by space(the rule is: between north and go there must be at least one character: a space, so that gornorth won't be interpreted as command.).

Bonus points: if it's possible to do that without some kind of black magic, I'd like to achieve following goals:

1)Before go, there can be any amount of characters, but if there is 1 or more characters, the character just before go must be space.
2)In between go and north, there must be at least one character, space. If there are more, then characters right after go and just before north have to be spaces.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved