collapse collapse

* Who's Online

  • Dot Guests: 131
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11164
  • stats Total Topics: 1700
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 1470

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Azrathud

Pages: [1]
1
General Talk / Favorite Wallpapers
« on: October 28, 2010, 02:36:29 am »
Post your favorite backgrounds here. Computer and techonogy oriented wallpapers are more favored.

Also, spoilers would be nice(I'm talking to you, Celestialkey) and a better way to look at them is by zooming out (ctrl -)

I made this from two other images and added some text


Firefox


Dwarven Justice at its finest


Pirate Everything


Video Games


I would if I could..


Charles Darwin






[edited name=Azrathud date=1288251561][/edited]

2
General Talk / What is your typing speed?
« on: June 13, 2010, 11:00:00 pm »
http://speedtest.10-fast-fingers.com/
How fast are you?

My typing speed is:



3
Suggestions / [bug] Website parses "BBcode" in [code] tags
« on: May 31, 2010, 05:21:14 pm »
Tags like [ i ] for italics(or for the variable i) inside of the tags [ code ] are parsed.

E.g.:
http://celestialcoding.com/index.php?topic=1534.msg10397#msg10397

4
C++ / Command Line Arguments: Quadratic Formula
« on: May 15, 2010, 05:22:17 pm »
Command line arguments are very quick and useful.

Here is an example of a program that takes command line arguments:
Code: C++
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7.     using namespace std;
  8.  
  9.     double a, b, c, negB, bSq, fourAC, twoA, simpSqrt, finalSqrt, x1, x2;
  10.  
  11.     if(argc != 4)
  12.         exit(-1);
  13.  
  14.     a = atoi(argv[1]);
  15.     b = atoi(argv[2]);
  16.     c = atoi(argv[3]);
  17.    
  18.     if(a == 0)
  19.     {
  20.         cerr << "Cannot set a equal to zero. This will cause a division of zero.";
  21.         exit(-1);
  22.     }
  23.     cout << "  a = " << a << "  b = " << b << "  c = " << c << "\n";
  24.     cout << "(-b (+ or -) sqrt(b^2 - 4ac))/2a\n";
  25.  
  26.     negB = -1 * b;
  27.  
  28.     cout << negB << " (+ or -) sqrt(" << b << "^2 - 4" << "*" << a << "*" << c << ")/2" << "*" << a << "\n";
  29.  
  30.     bSq = pow(b,2);
  31.     fourAC = -4 * a * c;
  32.     twoA = 2*a;
  33.  
  34.     cout << negB << " (+ or -) sqrt(" << bSq << " " <<  fourAC << ")/" << twoA << "\n";
  35.  
  36.     simpSqrt = bSq + fourAC;
  37.  
  38.     cout << negB << " (+ or -) sqrt(" << simpSqrt << ")/" << twoA << "\n";
  39.  
  40.     if(simpSqrt < 0)
  41.     {
  42.         cerr << "\n\nError: Cannot calclulate imaginairy values\n\n";
  43.         exit(-1);
  44.     }
  45.     finalSqrt = sqrt(simpSqrt);
  46.  
  47.     cout << negB << " (+ or -) " << finalSqrt << ")/" << twoA << "\n";
  48.  
  49.     x1 = negB + finalSqrt;
  50.     x2 = negB - finalSqrt;
  51.  
  52.     cout << "+ 1:  " << x1 << "/" << twoA << "\n";
  53.     cout << "- 2:  " << x2 << "/" << twoA << "\n";
  54.  
  55.     x1 /= twoA;
  56.     x2 /= twoA;
  57.  
  58.     cout << "x = " << x1 << "\n";
  59.     cout << "  OR \n";
  60.     cout << "x = " << x2 << "\n";
  61.  
  62.     return 0;
  63. }
  64.  
  65.  

Lets go over the code a bit first.
-------------------------------

int argc (argument count) - Holds the amount of arguments given. This always starts at 1 because the first argument is the file's name.

char *argv[] (argument vector) - This could be thought of as a pointer to a pointer or a array(pointer) of(to) C strings. Remember, arrays and pointers are essentially the same with some varying differences. This could also be written as char **argv but I think it looks scarier. This takes the arguments given and stores them. argv[0] is the file's name.

atoi - or array to integer. It takes a character array and converts it to an integer.

<cmath> - This STD library includes the used functions pow() and sqrt() and holds other useful math-related functions.

pow(double, double) - the first parameter takes the number you want to increase by the nth power. The second is the exponent that is n.

sqrt(double) - takes the parameter and returns the square root of it. Cannot take negative values(imaginary numbers) without using the <complex> library.


Note: Other variable types can be used in pow() and sqrt() besides double.
-------------------------------

Now to use the the program I included below or compile it yourself:

In Windows XP:

Hit the windows key + r to open run. Then, you will type cmd. Navigate the the folder containing quadForm.exe using cd(change directory). I stored it on the root directory of my C drive for simplicity. Type the file name(quadForm) with the arguments following the name. The first argument is a then b then c.

Pretty easy, eh?


Edit: Added error checking for setting a to zero.


[edited name=Azrathud date=1273977902][/edited]

5
Suggestions / Using HTML to Format posts
« on: April 21, 2010, 07:30:44 pm »
Would it be possible to use HTML to style our posts? Is it a matter of security?

6
General Talk / Does this happen to anyone else?
« on: April 05, 2010, 08:50:05 pm »

Would be better with spoilers

I think I have ADHD. Does anyone tend of have an enormous amount of tabs opened at once? Also a thought, does anyone get distracted easily?

7
Suggestions / Spoilers
« on: March 23, 2010, 11:47:38 am »
They don't work... Anyways, I think it would be a nice addition. Its awesome for enclosing large images and texts in.

8
Beta Releases / Pickn' Cats
« on: March 18, 2010, 06:57:08 pm »
Pickn' Cats a game I made a game in C++... with SDL! Its very simple, the basics. A guy runs across a 640X480 map picking up a cat with randomly generated coordinates.

You can navigate the beginning menus using the up and down arrow keys. Enter to select.
Controls:
  • Shift to move faster.
  • Arrow keys to move.

Features:
  • Menu screen
  • Energy bar
  • Rank
  • Shows cats collected
  • Running(no different animation from walking)
  • Sound when the player hits the cat

EDIT:
The code is a bit messy... Just a warning. I probably shouldn't of used classes at all for this.

My goal for my next project, whatever it may be, is to set up a engine first if one is needed. I also want to be wayyy more organised and use a more OO style.

Download Included at bottom with the executable and source.
I used nothing platform specific.

9
General Talk / Has anyone made any Facebook or Ipod apps?
« on: March 15, 2010, 01:52:48 pm »
    I was wondering how hard it would be to make an app for either Facebook or the Ipod Touch. I know making apps for the Ipod touch will be different from making them for Facebook. They are made in objective C for the Ipod I think. On Facebook they are programmed in PHP, JavaScript, Ruby on Rails, or AS3 I think. Its not about the money, if any at all. I would like to make programs that cam be viewed online by a lot of people. So I am curious, has anyone here made anything for these places? If so, how difficult is it?

Edited for grammatical errors

10
Code: Text
  1. obj\Debug\CApp_onInit.o||In function `_ZN4CApp6onInitEv':|
  2. C:\Documents and Settings\user.DANAHERTM\My Documents\projects\SDL tutorial basics\CApp_onInit.cpp|17|undefined reference to `CSurface::onLoad(char*)'|
  3. obj\Debug\CApp_onRender.o||In function `_ZN4CApp8onRenderEv':|
  4. C:\Documents and Settings\user.DANAHERTM\My Documents\projects\SDL tutorial basics\CApp_onRender.cpp|6|undefined reference to `CSurface::onDraw(int, int, SDL_Surface*, SDL_Surface*, SDL_Rect*)'|
  5. ||=== Build finished: 2 errors, 0 warnings ===|
  6.  
I replaced the real username with user for privacy.

CApp.h
Code: C++
  1. #ifndef _CAPP_H_
  2.     #define _CAPP_H_
  3.  
  4. #include "SDL/SDL.h"
  5.  
  6. #include "CSurface.h"
  7.  
  8. class CApp
  9. {
  10. private:
  11.  
  12.     bool done; // check if game loop wants to be run
  13.  
  14.     SDL_Surface* buffer;
  15.  
  16.     SDL_Surface* test;
  17.  
  18. public:
  19.  
  20.     CApp();
  21.  
  22.     int onExecute();
  23.  
  24.     bool onInit();
  25.  
  26.     void onEvent(SDL_Event* event);
  27.  
  28.     void onLoop();
  29.  
  30.     void onRender();
  31.  
  32.     void onCleanup();
  33. };
  34.  
  35. #endif
  36.  
  37.  


CApp.cpp
Code: C++
  1. #include "CApp.h"
  2.  
  3. CApp::CApp()
  4. {
  5.     done = false;
  6.     buffer = NULL;
  7.     test = NULL;
  8. }
  9.  
  10. int CApp::onExecute()
  11. {
  12.     if(!onInit())
  13.     {
  14.         return(-1);
  15.     }
  16.  
  17.     SDL_Event event;
  18.  
  19.     while(!done)
  20.     {
  21.         while(SDL_PollEvent(&event))
  22.         {
  23.              onEvent(&event);
  24.  
  25.         }
  26.  
  27.         onLoop();
  28.         onRender();
  29.     }
  30.  
  31.  
  32.     onCleanup();
  33.     return(0);
  34. }
  35.  
  36.  
  37. int main(int argc, char* argv[])
  38. {
  39.     CApp theApp;
  40.  
  41.     return(theApp.onExecute());
  42. }
  43.  
  44.  


C:\Documents and Settings\user.DANAHERTM\My Documents\projects\SDL tutorial basics\CApp_onInit.cpp|17|undefined reference to `CSurface::onLoad(char*)'|

onInit.cpp
Code: C++
  1. #include "CApp.h"
  2. #include "globals.h"
  3.  
  4. bool CApp::onInit()
  5. {
  6.     if(SDL_Init(SDL_INIT_EVERYTHING) < 0)
  7.     {
  8.         return(false);
  9.     }
  10.  
  11.     if((buffer = SDL_SetVideoMode(WIDTH, HEIGHT, BPP, SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL)
  12.     {
  13.         return(false);
  14.     }
  15.  
  16.     if((test = CSurface::onLoad("myImage.bmp")) == NULL)
  17.     {
  18.         return(false);
  19.     }
  20.  
  21.     return(true);
  22. }
  23.  
  24.  


C:\Documents and Settings\user.DANAHERTM\My Documents\projects\SDL tutorial basics\CApp_onRender.cpp|6|undefined reference to `CSurface::onDraw(int, int, SDL_Surface*, SDL_Surface*, SDL_Rect*)'|

onRender.cpp
Code: C++
  1. #include "CApp.h"
  2.  
  3.  
  4. void CApp::onRender()
  5. {
  6.     CSurface::onDraw(0, 0, test, buffer);
  7.  
  8.     SDL_Flip(buffer);
  9. }
  10.  

CSurface.h
Code: C++
  1. #ifndef _CSurface_h_
  2.     #define _CSurface_h_
  3. #include "sdl/sdl.h"
  4.  
  5. class CSurface
  6. {
  7. public:
  8.     CSurface();
  9.  
  10.     static SDL_Surface* onLoad(char* file);
  11.  
  12.     static bool onDraw(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = 0);
  13. };
  14.  
  15.  
  16. #endif
  17.  
  18.  

CSurface.cpp
Code: C++
  1. #include "CSurface.h"
  2.  
  3. CSurface::CSurface()
  4. {
  5. }
  6.  
  7. SDL_Surface* onLoad(char* file)
  8. {
  9.     SDL_Surface* temporary = 0;
  10.     SDL_Surface* optimized = 0;
  11.  
  12.     if((temporary = SDL_LoadBMP(file)) == NULL)
  13.     {
  14.         return(NULL);
  15.     }
  16.  
  17.     optimized = SDL_DisplayFormat(temporary);
  18.     SDL_FreeSurface(temporary);
  19.  
  20.     return(optimized);
  21. }
  22.  
  23. bool onDraw(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip)
  24. {
  25.     if(destination == NULL || source == NULL)
  26.     {
  27.         return(false);
  28.     }
  29.  
  30.     SDL_Rect offsets = {x, y};
  31.  
  32.     SDL_BlitSurface(source, clip, destination, &offsets);
  33.  
  34.     return(true);
  35. }
  36.  
  37.  

11
Suggestions / Changing the Chat back -- Celestial Chat
« on: February 26, 2010, 12:51:03 pm »
Hey folks. Ever since the chat was moved to IRC( server: irc.quakenet.org channel:#celestialcoding) there have been way less people on it. Usually there are less than 4 people on. :( Anyways, I would suggest moving back to what was previously.

12
General Talk / Jho's Website is Down?
« on: February 24, 2010, 06:29:06 pm »
What's going on?

13
C++ / iostream - std::cout - The difference between..
« on: January 18, 2010, 10:11:29 pm »
To really ask the question I probably must give you the source code:
Code: C++
  1. #include <iostream>
  2.  
  3. const int STACK_SIZE = 100; //maximum size of Stack
  4.  
  5.  
  6. /*******************************************************
  7.  *Stack class                                          *
  8.  *                                                     *
  9.  *Member functions                                     *
  10.  *       init -- intialize the stack.                  *
  11.  *       push -- put an item on the stack.             *
  12.  *       pop -- remove an item from the stack.         *
  13.  *******************************************************/
  14.  // The Stack itself
  15. class Stack
  16. {
  17. private:
  18.     int m_Count;          // Number of items in the Stack
  19.     int m_Data[STACK_SIZE];// The items themselves
  20. public:
  21.     //Initialize the Stack
  22.     void init();
  23.  
  24.     //Push an item on the Stack
  25.     void push(const int item);
  26.  
  27.     //  Pop an item from the Stack
  28.     int pop();
  29. };
  30.  
  31. /*******************************************************
  32.  * Stack::init -- initialize the stack.                *
  33.  *******************************************************/
  34. inline void Stack::init()
  35. {
  36.     m_Count = 0; // Zero the Stack
  37. }
  38.  
  39. /*******************************************************
  40.  * Stack::push -- push an item on the stack            *
  41.  *                                                     *
  42.  * Warning: We do not check for overflow.              *
  43.  *                                                     *
  44.  * Parameters                                          *
  45.  *       item -- item to put in the stack              *
  46.  *******************************************************/
  47. inline void Stack::push(const int item)
  48. {
  49.     m_Data[m_Count] = item;
  50.     ++m_Count;
  51. }
  52.  
  53. /*******************************************************
  54.  * Stack::pop -- get an item of the stack.             *
  55.  *                                                     *
  56.  * Warning: We do not check for stack overflow.        *
  57.  *                                                     *
  58.  * Returns                                             *
  59.  *      The top item from the stack                    *
  60.  *******************************************************/
  61. inline int Stack::pop()
  62. {
  63.     // Stack goes down by one
  64.     --m_Count;
  65.  
  66.     // Then return the top value
  67.     return(m_Data[m_Count]);
  68. }
  69.  
  70. //A short routine to test the stack
  71. int main()
  72. {
  73.     class Stack aStack; // Stack we want to use
  74.  
  75.     aStack.init();
  76.  
  77.     //Push three value on the stack
  78.     aStack.push(1);
  79.     aStack.push(2);
  80.     aStack.push(3);
  81.  
  82.     //Pop the item from the stack
  83.     std::cout   << "Expect a 3 ->" << aStack.pop() << '\n'
  84.                 << "Expect a 2 ->" << aStack.pop() << '\n'
  85.                 << "Expect a 1 ->" << aStack.pop() << '\n';
  86.     return(0);
  87. }
  88.  
  89.  

Code: C++
  1. #include <iostream>
  2.  
  3. const int STACK_SIZE = 100; //maximum size of Stack
  4.  
  5.  
  6. /*******************************************************
  7.  *Stack class                                          *
  8.  *                                                     *
  9.  *Member functions                                     *
  10.  *       init -- intialize the stack.                  *
  11.  *       push -- put an item on the stack.             *
  12.  *       pop -- remove an item from the stack.         *
  13.  *******************************************************/
  14.  // The Stack itself
  15. class Stack
  16. {
  17. private:
  18.     int m_Count;          // Number of items in the Stack
  19.     int m_Data[STACK_SIZE];// The items themselves
  20. public:
  21.     //Initialize the Stack
  22.     void init();
  23.  
  24.     //Push an item on the Stack
  25.     void push(const int item);
  26.  
  27.     //  Pop an item from the Stack
  28.     int pop();
  29. };
  30.  
  31. /*******************************************************
  32.  * Stack::init -- initialize the stack.                *
  33.  *******************************************************/
  34. inline void Stack::init()
  35. {
  36.     m_Count = 0; // Zero the Stack
  37. }
  38.  
  39. /*******************************************************
  40.  * Stack::push -- push an item on the stack            *
  41.  *                                                     *
  42.  * Warning: We do not check for overflow.              *
  43.  *                                                     *
  44.  * Parameters                                          *
  45.  *       item -- item to put in the stack              *
  46.  *******************************************************/
  47. inline void Stack::push(const int item)
  48. {
  49.     m_Data[m_Count] = item;
  50.     ++m_Count;
  51. }
  52.  
  53. /*******************************************************
  54.  * Stack::pop -- get an item of the stack.             *
  55.  *                                                     *
  56.  * Warning: We do not check for stack overflow.        *
  57.  *                                                     *
  58.  * Returns                                             *
  59.  *      The top item from the stack                    *
  60.  *******************************************************/
  61. inline int Stack::pop()
  62. {
  63.     // Stack goes down by one
  64.     --m_Count;
  65.  
  66.     // Then return the top value
  67.     return(m_Data[m_Count]);
  68. }
  69.  
  70. //A short routine to test the stack
  71. int main()
  72. {
  73.     class Stack aStack; // Stack we want to use
  74.  
  75.     aStack.init();
  76.  
  77.     //Push three value on the stack
  78.     aStack.push(1);
  79.     aStack.push(2);
  80.     aStack.push(3);
  81.  
  82.     //Pop the item from the stack
  83.     std::cout   << "Expect a 3 ->" << aStack.pop() << '\n';
  84.     std::cout   << "Expect a 2 ->" << aStack.pop() << '\n';
  85.     std::cout   << "Expect a 1 ->" << aStack.pop() << '\n';
  86.     return(0);
  87. }
  88.  

Okay, so when popping the stack and outputting info not using another std::cout and just seperating a line (former) I do not get a stack.. It outputs in a unexpected order. When I break up the output (latter) , the stack works... My question is: Why is there a difference?

14
Technology / Augmented Reality
« on: November 06, 2009, 04:59:51 pm »

:Tagging reality:


















:How to make your own augmented reality:


Pages: [1]

Donate


* Search


* Recent Posts

I miss the chatbox by Shishka
[August 27, 2019, 11:52:39 pm]


Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]