Labdabeta 182 Posting Pro in Training Featured Poster

I have made a header file with a templated dynamic array class that I wish to convert into secure code. The problem is that since all of the code relies on the Template I cannot put it into a static library. Any ideas how I could still make the source hidden, but keep functionality public?

Labdabeta 182 Posting Pro in Training Featured Poster

Thanks!

Labdabeta 182 Posting Pro in Training Featured Poster

I have asked this question before on a different forum without success. I would like to know how to do templated type conversions for a class. The syntax is getting me though. Here is what I want:

class Thing
{
    public:
    template <typename T>
    T operator T();
}

This would allow me to cast my class to anything! Is this possible?

Labdabeta 182 Posting Pro in Training Featured Poster

Been away on vacation w/o internet. Anyways, that is a great solution and more than less exactly what I was looking for. The only issue is that upon investigation through the header file source code itself I found a function called Save_BMP. As it turns out it does exactly what it says. I guess I went on a wild goose chase for nothing. Your code has not gone to waste however, I am implementing it for saving other file formats. (Although writing those files so dang precisely is annoying!) THANKS FOR YOUR HELP!

Labdabeta 182 Posting Pro in Training Featured Poster

Unfortunately I am having trouble using that forum. Is there any way that I could get one of you to post my question there for me? (I have tried to register 3 times to no avail)

Labdabeta 182 Posting Pro in Training Featured Poster

Quick question (hopefully), how do I save an SDL_Surface image to a file?

Labdabeta 182 Posting Pro in Training Featured Poster

I have one quick question then. Could you create a class inside a function, define its functions then return the class to access its functions? Also when does C++0x come out and how do we get it?

Labdabeta 182 Posting Pro in Training Featured Poster

I need a few helps for some things that I just cannot get the syntax of! (I need these, and if you don't believe me I can post the reason)
1) Creating a function within a function
2) Creating a class within a function
3) Declaring a template function outside a class
EXAMPLES:
1)

typedef void(*FUNC)();
FUNC GenFunc()
{
     FUNC ret=;//HELP! I NEED TO MAKE A FUNCTION
     return ret;
}

2)

class Abstract
{
    public:
    virtual void do()=0;
}
Abstract &getClass()
{
    Abstract &ret=;//HELP! I NEED TO MAKE A CLASS DERIVED FROM Abstract
    return ret;
}

3)

class Thing
{
    public:
    template <typename T>
    T thingy();
}
//NOW WHAT? HOW DO I WRITE THE CODE OF thingy?!

Answers to any of these questions would be greatly appreciated, thanks!

Labdabeta 182 Posting Pro in Training Featured Poster

I just did some research and it seems that scrnsave.h is supposed to define main, but here is the source code of my scrnsave.h (notice no main):

/*
  Screen saver library by Anders Norlander <anorland@hem2.passagen.se>

  This library is (hopefully) compatible with Microsoft's
  screen saver library.

  This is public domain software.

 */
#ifndef _SCRNSAVE_H
#define _SCRNSAVE_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* configure dialog identifier */
#define DLG_SCRNSAVECONFIGURE 2003

#define idsIsPassword		1000
#define idsIniFile		1001
#define idsScreenSaver		1002
#define idsPassword		1003
#define idsDifferentPW		1004
#define idsChangePW		1005
#define idsBadOldPW		1006
#define idsAppName		1007
#define idsNoHelpMemory		1008
#define idsHelpFile		1009
#define idsDefKeyword		1010

#define IDS_DESCRIPTION 1
#define ID_APP 100

#define WS_GT (WS_GROUP | WS_TABSTOP)
#define SCRM_VERIFYPW		WM_APP
#define MAXFILELEN		13
#define TITLEBARNAMELEN		40
#define APPNAMEBUFFERLEN	40
#define BUFFLEN			255

#ifndef RC_INVOKED

/* functions provided by the aothor of the screen saver */
BOOL WINAPI ScreenSaverConfigureDialog(HWND,UINT,WPARAM,LPARAM);
BOOL WINAPI RegisterDialogClasses(HANDLE);
LONG WINAPI ScreenSaverProc(HWND,UINT,WPARAM,LPARAM);

/* Change name of function if we are using UNICODE */
#ifdef UNICODE
#define DefScreenSaverProc DefScreenSaverProcW
#endif

/* default screen saver proc; call instead of DefWindowProc */
LONG WINAPI DefScreenSaverProc(HWND,UINT,WPARAM,LPARAM);

/* change password */
void WINAPI ScreenSaverChangePassword(HWND);

/* globals that may be used by screen saver */
extern HINSTANCE	hMainInstance;
extern HWND		hMainWindow;
extern BOOL		fChildPreview;
extern TCHAR		szName[];
extern TCHAR		szAppName[];
extern TCHAR		szIniFile[];
extern TCHAR		szScreenSaver[];
extern TCHAR		szHelpFile[];
extern TCHAR		szNoHelpMemory[];
extern UINT		MyHelpMessage;

#endif /* RC_INVOKED */

#ifdef __cplusplus
}
#endif

#endif /* _SCRNSAVE_H */
Labdabeta 182 Posting Pro in Training Featured Poster

Yes I do link the SDL library with this project since there are other files in the project that have to use it. Is there any way to unlink it for one file?

Labdabeta 182 Posting Pro in Training Featured Poster

I am making a screensaver and it won't build! The error I get is "undefined reference to '_SDL_main'. Here is my code:

#include <windows.h>
#include <scrnsave.h>
BOOL WINAPI ScreenSaverConfigureDialog(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
    system("TMXDB.exe");
    return true;
}
BOOL WINAPI RegisterDialogClasses(HANDLE hmodule)
{
    return true;
}
int TMR;
LONG WINAPI ScreenSaverProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{
	switch(message)
	{
	case WM_CREATE:
        system("TMXSCR.exe");
        return 0;
	case WM_ERASEBKGND:
		return 0;
	case WM_TIMER:
		return 0;
	case WM_DESTROY:
		KillTimer(hwnd,TMR);
		PostQuitMessage(0);
		return 0;
	}
	return 0;
}

What do I do to fix this (I don't usually program with windows API (thats why all I do is call my screensaver executable rather than actually doing something with windows API, so it could be something simple)

Labdabeta 182 Posting Pro in Training Featured Poster

Thank you, that is exactly what I was looking for!

Labdabeta 182 Posting Pro in Training Featured Poster

I am working on making a 'safetype' abstract class, which will have a complete set of pure virtual operator overloads to help make sure that a class inherited from it is safe to pass to virtual any function. The problem is that I don't know the syntax of a pure virtual operator overload or if any of the operators are unable to be virtualized. Can somebody give me an example of how to write a pure virtual operator, as well as list any operators that cannot be made purely virtual?

Labdabeta 182 Posting Pro in Training Featured Poster

Thank you for the help! :)

Labdabeta 182 Posting Pro in Training Featured Poster

Ok, thank you, it is working preliminarily now (i decided not to use C++0x just yet, especially since I did not want to delete all those lines of code). The only thing missing is the RELATIVE_PATH macro that you used. I assumed that it was a predefined macro, but it isn't. What do I have to define RELATIVE_PATH as?

Labdabeta 182 Posting Pro in Training Featured Poster

When passing something to a function as a reference you have to reference it. You are passing a normal double to your bVolume function, but double is not double&

Labdabeta 182 Posting Pro in Training Featured Poster

Thanks, the ellipses in template would be perfect, but I don't understand what I need to do to implement it. I am using Code::Blocks v8.[something] how do I let it use the variadic templates.

P.S.: The repetitive code is a result of a chemistry class with no teacher, but we still had to sit at our desks and 'work' on our laptops :P

Labdabeta 182 Posting Pro in Training Featured Poster

I am working on making an error header file and this is what I have:

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#define VANARGS(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n33,n34,n35,n36,n37,n38,n39,n40,n41,n42,n43,n44,n45,n46,n47,n48,n49,n50,n51,n52,n53,n54,n55,n56,n57,n58,n59,n60,n61,n62,n63,N,...) N
#define __VA_NARGS__(...) (VANARGS(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0))
#define ERROR(...) (\
(__VA_NARGS__(__VA_ARGS__)==0)?"NONE":(\
(__VA_NARGS__(__VA_ARGS__)==1)?(_1(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==2)?(_2(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==3)?(_3(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==4)?(_4(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==5)?(_5(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==6)?(_6(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==7)?(_7(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==8)?(_8(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==9)?(_9(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==10)?(_10(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==11)?(_11(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==12)?(_12(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==13)?(_13(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==14)?(_14(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==15)?(_15(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==16)?(_16(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==17)?(_17(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==18)?(_18(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==19)?(_19(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==20)?(_20(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==21)?(_21(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==22)?(_22(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==23)?(_23(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==24)?(_24(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==25)?(_25(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==26)?(_26(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==27)?(_27(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==28)?(_28(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==29)?(_29(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==30)?(_30(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==31)?(_31(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==32)?(_32(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==33)?(_33(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==34)?(_34(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==35)?(_35(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==36)?(_36(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==37)?(_37(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==38)?(_38(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==39)?(_39(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==40)?(_40(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==41)?(_41(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==42)?(_42(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==43)?(_43(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==44)?(_44(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==45)?(_45(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==46)?(_46(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==47)?(_47(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==48)?(_48(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==49)?(_49(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==50)?(_50(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==51)?(_51(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==52)?(_52(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==53)?(_53(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==54)?(_54(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==55)?(_55(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==56)?(_56(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==57)?(_57(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==58)?(_58(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==59)?(_59(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==60)?(_60(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==61)?(_61(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(__VA_NARGS__(__VA_ARGS__)==62)?(_62(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\
(_63(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
#define _1(A,...) _1_(A)
#define _2(A,B,...) _2_(A,B)
#define _3(A,B,C,...) _3_(A,B,C)
#define _4(A,B,C,D,...) _4_(A,B,C,D)
#define _5(A,B,C,D,E,...) _5_(A,B,C,D,E)
#define _6(A,B,C,D,E,F,...) _6_(A,B,C,D,E,F)
#define _7(A,B,C,D,E,F,G,...) _7_(A,B,C,D,E,F,G)
#define _8(A,B,C,D,E,F,G,H,...) _8_(A,B,C,D,E,F,G,H)
#define _9(A,B,C,D,E,F,G,H,I,...) _9_(A,B,C,D,E,F,G,H,I)
#define _10(A,B,C,D,E,F,G,H,I,J,...) _10_(A,B,C,D,E,F,G,H,I,J)
#define _11(A,B,C,D,E,F,G,H,I,J,K,...) _11_(A,B,C,D,E,F,G,H,I,J,K)
#define _12(A,B,C,D,E,F,G,H,I,J,K,L,...) _12_(A,B,C,D,E,F,G,H,I,J,K,L)
#define _13(A,B,C,D,E,F,G,H,I,J,K,L,M,...) _13_(A,B,C,D,E,F,G,H,I,J,K,L,M)
#define _14(A,B,C,D,E,F,G,H,I,J,K,L,M,N,...) _14_(A,B,C,D,E,F,G,H,I,J,K,L,M,N)
#define _15(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,...) _15_(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O)
#define _16(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,...) _16_(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P)
#define _17(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,...) _17_(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q)
#define _18(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,...) _18_(A,B,C,D,E,F,G,H,I,J,K,L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L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,...) _49_(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW)
#define _50(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,...) _50_(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX)
#define …
Labdabeta 182 Posting Pro in Training Featured Poster

Nevermind, I posted too soon. Just figured it out:

#include <string>
int numb(char in)
{
    if (in>='0'&&in<='9')
        return in-'0';
    else if (in>='a'&&in<='z')
        return in-'a';
    else if (in>='A'&&in<='Z')
        return in-'A';
    else
        return 0;
}
template <typename T>
T pow(T n1, T n2)
{
    if (n2==0)
        return 1;
    else if (n2==1)
        return n1;
    else
        return pow<T>(n1, n2-1)*n1;
}
template <const int base,typename T>
T B(std::string num)
{
    T ret=0;
    for (int i=0; i<num.length(); i++)
        ret+=numb(num[num.length()-i-1])*pow(T(base),T(i));
    return ret;
}
Labdabeta 182 Posting Pro in Training Featured Poster

I made a header file to convert strings to numbers of base X. That is I want:

int num=B<16,int>("FFF");

To equal:

int num=0xFFF;

Here is the code so far:

#include <string>
int numb(char in)
{
    if (in>='0'&&in<='9')
        return in-'0';
    else if (in>='a'&&in<='z')
        return in-'a';
    else if (in>='A'&&in<='Z')
        return in-'A';
}
template <typename T>
T pow(T n1, T n2)
{
    T temp=n1;
    for (T i=0; i<n2; i++)
        temp*=n1;
    return temp;
}
template <const int base,typename T>
T B(std::string num)
{
    T ret=0;
    for (int i=0; i<num.length(); i++)
        ret+=numb(num[num.length()-i-1])*pow(T(base),T(i));
    return ret;
}

The problem is that it isn't working. Can anybody see why?

Labdabeta 182 Posting Pro in Training Featured Poster

You may want to look at using the substr method and the find method for std::strings to help break strings apart.

Labdabeta 182 Posting Pro in Training Featured Poster

I gave in and decided to make a project. All is well again :)

Labdabeta 182 Posting Pro in Training Featured Poster

There is no process there, just Code::Blocks itself and my other programs, but not the process that I was testing. Also it still doesn't hide the console when I run the executable outside of Code::Blocks.

Labdabeta 182 Posting Pro in Training Featured Poster

Sorry for the double post, but I hit another problem. When I ran the program from C::B the console disappeared, but now its waiting for me to "Hit any key to continue..." before I can build it again. But the console is gone, so how do I get it to end execution?

Labdabeta 182 Posting Pro in Training Featured Poster

Thanks, I was able to figure a way out:

SetConsoleTitle("||||||||||");
    Sleep(5);
    HWND CONSOLE=FindWindow(NULL, "||||||||||");
    ShowWindow(CONSOLE, SW_HIDE);

This works fine when run from Code::Blocks, but when run as a stand-alone executable the console doesn't go away?

Labdabeta 182 Posting Pro in Training Featured Poster

For some reason it is telling me that GetConsoleWindow() was not declared in this scope, even though I included <windows.h>? I also tried changing <windows.h> to <Windows.h> with no success. Here are my headers:

#include <windows.h>
#include <fstream>
#include <sstream>
#include "SDL\SDL.h"
#include "SDL\SDL_image.h"
#include "SDL\SDL_ttf.h"
#include "SDL\SDL_mixer.h"
#include "Random.h"
#define WINDOW_WIDTH 200
#define WINDOW_HEIGHT 50
#define WINDOW_BPP 32

Any ideas?

Labdabeta 182 Posting Pro in Training Featured Poster

Well, here is what I would basically do, it takes advantage of some of the methods that std::string contains:

string *BreakUp(string in, int *num)//This translates a command into an array of strings, num will become the length of said array
{
    int numWords=0;//This is the number of words in the command
    for (int i=0; i<in.length(); i++)//loop through the word
    {
        if (in[i]==' ')//if it is a strength
        {
            numWords++;
        }
    }
    *num=numWords;//set num
    string *ret=new string[numWords];//Create the return vector
    for (int i=0; i<numWords; i++)
    {
        ret[i]=in.substr(0, in.find_first_of(' '));//Grab the first word
        in=in.substr(in.find_first_of(' ')+1);//Strip the first word from the string
    }
    return ret;//return the array of strings
}

Of course you would have to take over from there though.

EDIT: DANG WALTP BEAT ME WHILE I WAS WRITING THE CODE!

Labdabeta 182 Posting Pro in Training Featured Poster

The issue is that it isn't a project. I tend to make my own projects because they are slightly smaller in size and easier to run. All I have is an executable in the same folder as a bunch of resources (images, sounds, headers). Is there any way to do this from within the .cpp so that the .exe hides the executable on its own?

Here is the folder (I just used the tree /f command):

ALARM.wav
BAD.png
FONT.ttf
GOOD.png
GUIGamingCounter.exe
ICON.bmp
ICON.ico
jpeg.dll
libpng12-0.dll
libtiff-3.dll
MINUTES.txt
Random.h
SDL_image.dll
zlib1.dll

Labdabeta 182 Posting Pro in Training Featured Poster

Hello,
I have decided to make a timer program on my computer to limit the amount of time that I game. Anyways, I have it working fine with a small borderless window in the top left of the screen that ticks down and when it gets to 0 it sounds an alarm, turns red, and waits for me to click it. The problem is that the console window pops up and looks very out of place. Is there some kind of SDL or Windows function that will allow me to destroy that window yet still maintain all the functionality of my SDL window?

Labdabeta 182 Posting Pro in Training Featured Poster

Ok, ok, you win you're right.

Labdabeta 182 Posting Pro in Training Featured Poster

The problem is that friend methods don't get passed down to inherited classes. Here is an illustration of what I mean:
Won't work, friend method does not get passed down:

#include <iostream>
using namespace std;
class Base
{
    public:
    friend void out(){cout<<"BASE";}
};
class Derived:public Base
{};
int main()
{
    Derived bob;
    bob.out();
    return 0;
}

Will work, out is inherited from Base:

#include <iostream>
using namespace std;
class Base
{
    public:
    void out(){cout<<"BASE";}
};
class Derived:public Base
{};
int main()
{
    Derived bob;
    bob.out();
    return 0;
}

Hope this helps. (In short I think you will have to either write another << operator or maybe find out the syntax for a virtual << operator overload)

Labdabeta 182 Posting Pro in Training Featured Poster

The precision function could be useful here:

cout.precision(2);
cout<<2.234134<<endl;
cout<<2.343144<<endl;

Outputs:
2.2
2.3

In other words, using cout.precision(X) sets the precision of cout to X and it stays that way until cout.precision(Y) is called, then the precision is set to Y.

Alse try to avoid using system("pause"), try using cin.get() instead.

Labdabeta 182 Posting Pro in Training Featured Poster

I understand WaltP, VB is nearly completely for Windows (I actually wrote that, but changed it when I remembered that a friend of mine was able to get a simple program to work on his Linux computer) I should probably have used a better example, I am sorry *looks down in embarrassment*
Anyways, I was taught pseudocode a while ago for language and platform independant pauses, this syntax being:

Create a variable and set it to a value that is hard to enter (I usually use '\a' the alarm value)
While that variable is that value, ask the user to input that variable with no prompt.

The good thing about this is that it works even if input times out (like if you are using SDL_Event and SDL_PollEvent instead of SDL_WaitEvent)

Basic point is, the website that WaltP linked to seems to be good as far as I can tell, and if you need to pause in another circumstance or language than try a looping input.

Labdabeta 182 Posting Pro in Training Featured Poster

You have to include windows.h, then system("pause") or system("PAUSE") will work fine. Here is a simple code I wrote to display the fact:

#include <windows.h>
int main()
{
    system("PAUSE");
    return 0;
}

Also although it is generally best to avoid OS specificity and keep C++ platform independant, sometimes it is more powerful to just use the system. (for example the horrible [in my opinion] language of VB is highly OS dependant on windows, yet it is an extremely powerful language that allows you to move windows through each other, and do hardware specific tasks. Though I still recommend using a platform independant method, or at least using a header check like #ifdef _WIN32 which checks if the system is windows 32 bit.

Labdabeta 182 Posting Pro in Training Featured Poster

THANK YOU! I knew it would be something stupid with the pointers, come to think of it, it fails after the blitting, but that is also the last line, where the sprite goes out of scope! I'm gonna just try deleting the deconstructor, so what if I have some deallocated memory, it will be overwritten later.

Labdabeta 182 Posting Pro in Training Featured Poster

Yes, it usually happens at the end of the conversion from Sprite to SDL_Surface *, although occasionally it happens at the Draw function. I think that somehow the Sprite is getting delete[]d after it's pixel surface is blitted, I just can't see why.

Labdabeta 182 Posting Pro in Training Featured Poster

Not sure if this is what you are looking for but whenever I have a class that I wish to write to a file I just overload the '<<' operator, then I can do it specially for each object and string them together like:

fstream file("MyFile.txt", ios_base::in|ios_base::out);
file<<MyClass()<<MyOtherClass()<<AnotherMyClass()<<2<<"BOB"<<endl;
And it works fine.
Labdabeta 182 Posting Pro in Training Featured Poster

If you still wish to do all the outputs and inputs on the same line, the '\b' character might work. You could possibly use it to delete the newline character. Just a thought.

One way I know for sure works though is using the Windows.h SetConsoleCursorPosition(). See:
http://www.adrianxw.dk/SoftwareSite/index.html

Or you could try looking up the getch() function to get input w/o waiting for ENTER key.

Hope this helps!

Labdabeta 182 Posting Pro in Training Featured Poster

I went through all of learncpp.com's tutorials, they were great and tackle almost everything syntax wise. I am now working with Lazy Foo's tutorials for SDL GUI applications:
http://www.learncpp.com/
http://lazyfoo.net/SDL_tutorials/index.php

Hope these help :)

Labdabeta 182 Posting Pro in Training Featured Poster

I have made a header file for SDL GUI applications. I was testing the SDLGame::Draw() function when I got a SigSegV fault. The fault occurs in different locations each time I run the program. Also sometimes instead of a SigSegV fault I get a SigTrap fault. Here is the code involved with the SigSegV.
SDLGame class constructor:

SDLGame::SDLGame(int w, int h, int bpp, Uint32 flags)
{
    if (SDL_Init(SDL_INIT_EVERYTHING)==-1)
        exit(-1);
    Window=SDL_SetVideoMode(w, h, bpp, flags);
    if (Window==NULL)
        exit(-2);
}

SDLGame class Draw():

void SDLGame::Draw(Sprite img, int x, int y)
{
    SDL_Rect offset;
    offset.x=x;
    offset.y=y;
    SDL_BlitSurface((SDL_Surface*)img, NULL, Window, &offset);
}

Sprite class constructor (from file):

Sprite::Sprite(char *filename)
{
    SDL_Surface *Temp=IMG_Load(filename);
    if (Temp!=NULL)
    {
        SDL_Surface *Good=SDL_DisplayFormatAlpha(Temp);
        pixels=new Pixel32[Good->w*Good->h];
        w=Good->w;
        h=Good->h;
        pixels=(Pixel32*)Good->pixels;
        SDL_FreeSurface(Temp);
        //SDL_FreeSurface(Good);
    }
    else
    {
        pixels=NULL;
        w=0;
        h=0;
        SDL_FreeSurface(Temp);
    }
}

Sprite class SDL_Surface typecast operator:

Sprite::operator SDL_Surface*()const
{
    SDL_Surface *ret=NULL;
    ret=SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
    Pixel32 *surface=(Pixel32*)ret->pixels;
    for (int i=0; i<(w*h); i++)
    {
        if (!pixels[i]||!surface[i])
        {
            i=(w*h);
            break;
        }
        surface[i]=pixels[i];
    }
    SDL_Surface *dup=ret;
    ret->refcount++;
    return dup;
}

Pixel32 is essentially typedef'd as Uint32. This is the basis of my main() function (but not it entirely, I think the problem lies in the fact that I draw a surface twice):

int main()
{
SDL_Game TTT(600, 600, 32, SDL_SWSURFACE);
Sprite Board("BOARD.png");
TTT.Draw(Board, 0, 0);
TTT.Step();
TTT.Draw(Board, 0, 0);
TTT.Step();
return 0;
}

If I need to post the whole code I can. I just don't wish to right now. Could anybody solve this problem without …