I only get errors when i try to compile
This code works when i placed it inside shaderhud.pp only.
it may dont understand some callers maybe i dont know anything about this
Can anybody plz tell me whats wrong ?
I would be happy if someone can help me
This is my testhud.h:
/* TestHUDItemClass
Copyright 2009 Mark Sararu
This file is part of the Renegade scripts.dll
The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version. See the file COPYING for more details.
In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module
that does not contain code covered by this licence.
Only the source code to the module(s) containing the licenced code has to be released.
*/
// Created by Raptor*[RSF]
#ifndef SHADERS_TestHUD_H_
#define SHADERS_TestHUD_H_
class TestHUDItemClass
{
protected:
bool Enabled;
Render2DClass* Render2D;
Render2DTextClass* Render2DText;
float LastHealth;
bool FlashActive;
unsigned int EndFlashTime;
unsigned int EndBlinkTime;
bool ForceInfoDisplayDuringLowHealth;
float LowHealthThreshold;
unsigned int HealthInfoFlashDuration; // in msec
unsigned int LowHealthBlinkDuration; // ^
Vector2 BackgroundSize;
Vector2 BackgroundPosition;
RectClass BackgroundUV;
char * BackgroundTextureFile;
Vector2 TextPosition;
char * TextFontFile;
public:
TestHUDItemClass();
~TestHUDItemClass();
void Load(INIClass* ini);
void Render();
};
extern TestHUDItemClass TestHUD;
#endif
This is my testhud.cpp:
//--------------------------------------------------------------------------------
// health hud item rendering/loading code
//--------------------------------------------------------------------------------
TestHUDItemClass::TestHUDItemClass():
// TeamVehCount-number
Render2DTextClass *TeamVehCountRender2DClass = 0;
bool RenderTeamVehCountText = false;
unsigned int TeamVehCountColor = 0;
Vector2 *TeamVehCountPosition = 0;
bool TeamVehCountEnabled = false;
Vector2 *TeamVehCountOffset = 0;
{
};
TestHUDItemClass::~TestHUDItemClass()
{
SAFE_DELETE(TeamVehCountPosition);
SAFE_DELETE(TeamVehCountRender2DClass);
};
void TestHUDItemClass::Load(INIClass *ini)
{
if (!ini) return; // if you don't have an ini, something is horribly wrong!
// TeamVehCount-Number
TeamVehCountEnabled = hudini->Get_Bool("General","TeamVehCountEnabled",false);
if (TeamVehCountEnabled)
{
bool TeamVehCountVisible = hudini->Get_Bool("General","TeamVehCountVisible",true);
float TeamVehCountXPos = hudini->Get_Float("General","TeamVehCountXPos",118);
float TeamVehCountYPos = hudini->Get_Float("General","TeamVehCountYPos",717);
if (TeamVehCountXPos < 0)
{
TeamVehCountXPos += ScreenResolution->Right;
}
if (TeamVehCountYPos < 0)
{
TeamVehCountYPos += ScreenResolution->Bottom;
}
char TeamVehCountFont[100];
hudini->Get_String("General","TeamVehCountFont","FONT6x8.TGA",TeamVehCountFont,sizeof(TeamVehCountFont));
unsigned int TeamVehCountCol = hudini->Get_Int("General","TeamVehCountColor",0);
TeamVehCountPosition = new Vector2(TeamVehCountXPos,TeamVehCountYPos);
RenderTeamVehCountText = TeamVehCountVisible;
TeamVehCountColor = (*Colors)[TeamVehCountCol];
TeamVehCountRender2DClass = CreateRender2DTextClass(TeamVehCountFont);
}
};
void TestHUDItemClass::Render()
{
if (RenderTeamVehCountText)
{
TeamVehCountRender2DClass->Reset();
RectClass *r = (RectClass *)((char *)TeamVehCountRender2DClass+0x5B8);
float TeamVehCount = float(Get_Team_Vehicle_Count(Get_Player_Type(obj)));
r->Right = TeamVehCountPosition->X;
r->Left = TeamVehCountPosition->X;
r->Top = TeamVehCountPosition->Y;
r->Bottom = TeamVehCountPosition->Y;
char text[10];
unsigned int h = (unsigned int)(TeamVehCount + 0.5f);
sprintf(text,"Team Vehicle Count: %d",h);
unsigned int color = TeamVehCountColor;
TeamVehCountRender2DClass->Draw_Text(text,color);
TeamVehCountRender2DClass->Render();
}
};
//--------------------------------------------------------------------------------
// globals
//--------------------------------------------------------------------------------
TestHUDItemClass TestHUD;
TestHUD.cpp
.\TestHUD.cpp(49) : error C2059: syntax error : '*'
.\TestHUD.cpp(50) : error C2062: type 'bool' unexpected
.\TestHUD.cpp(50) : error C2630: ';' found in what should be a comma-separated list
.\TestHUD.cpp(51) : error C2062: type 'unsigned int' unexpected
.\TestHUD.cpp(51) : error C2630: ';' found in what should be a comma-separated list
.\TestHUD.cpp(52) : error C2059: syntax error : '*'
.\TestHUD.cpp(52) : error C2630: ';' found in what should be a comma-separated list
.\TestHUD.cpp(53) : error C2062: type 'bool' unexpected
.\TestHUD.cpp(53) : error C2630: ';' found in what should be a comma-separated list
.\TestHUD.cpp(54) : error C2059: syntax error : '*'
.\TestHUD.cpp(54) : error C2630: ';' found in what should be a comma-separated list
.\TestHUD.cpp(55) : error C2059: syntax error : '{'
.\TestHUD.cpp(55) : error C2630: ';' found in what should be a comma-separated list
.\TestHUD.cpp(62) : error C2065: 'TeamVehCountPosition' : undeclared identifier
.\TestHUD.cpp(62) : error C2541: 'delete' : cannot delete objects that are not pointers
.\TestHUD.cpp(63) : error C2065: 'TeamVehCountRender2DClass' : undeclared identifier
.\TestHUD.cpp(63) : error C2541: 'delete' : cannot delete objects that are not pointers
.\TestHUD.cpp(73) : error C2065: 'TeamVehCountEnabled' : undeclared identifier
.\TestHUD.cpp(73) : error C2065: 'hudini' : undeclared identifier
.\TestHUD.cpp(73) : error C2227: left of '->Get_Bool' must point to class/struct/union/generic type
type is ''unknown-type''
.\TestHUD.cpp(76) : error C2227: left of '->Get_Bool' must point to class/struct/union/generic type
type is ''unknown-type''
.\TestHUD.cpp(77) : error C2227: left of '->Get_Float' must point to class/struct/union/generic type
type is ''unknown-type''
.\TestHUD.cpp(78) : error C2227: left of '->Get_Float' must point to class/struct/union/generic type
type is ''unknown-type''
.\TestHUD.cpp(88) : error C2227: left of '->Get_String' must point to class/struct/union/generic type
type is ''unknown-type''
.\TestHUD.cpp(89) : error C2227: left of '->Get_Int' must point to class/struct/union/generic type
type is ''unknown-type''
.\TestHUD.cpp(91) : error C2065: 'RenderTeamVehCountText' : undeclared identifier
.\TestHUD.cpp(92) : error C2065: 'TeamVehCountColor' : undeclared identifier
.\TestHUD.cpp(92) : error C2065: 'Colors' : undeclared identifier
.\TestHUD.cpp(103) : error C2227: left of '->Reset' must point to class/struct/union/generic type
type is ''unknown-type''
.\TestHUD.cpp(105) : error C2065: 'obj' : undeclared identifier
.\TestHUD.cpp(105) : fatal error C1903: unable to recover from previous error(s); stopping compilation
tonemapsceneshader.cpp
stackingsceneshader.cpp
simplesceneshader.cpp
Build log was saved at "file://c:\Documents and Settings\Administrator\Bureaublad\scripts344_Raptor-RSF\tmp\shaders\BuildLog.htm"
shaders - 31 error(s), 0 warning(s)
I have these inside my shaderhud.cpp:
#include "testhud.h" // TestHUD
--------------------------------------------------------
extern "C"
{
void __declspec(dllexport) ReadHUDBits(INIClass *hudini)
{
TestHUD.Load(hudini); // TestHUD
//------------------------------------------------------
void __declspec(dllexport) UpdateHUD2()
{
TestHUD.Render(); // TestHUD
[Updated on: Sun, 07 June 2009 12:48]
Report message to a moderator