Results 1 to 4 of 4

Thread: COLOR HELP

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    24

    COLOR HELP

    I wrote a color script to change parts of tha game with my opengl but im having problems compiling i keep getting

    C:\hudintercept\color.cpp(154) : error C2146: syntax error : missing ';' before identifier 'thelogo'
    C:\hudintercept\color.cpp(154) : fatal error C1004: unexpected end of file found
    what do i do?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: COLOR HELP

    It might be helpful if you would post a bit of code. Especially line 154 of color.cpp.

    All I can say about your error is that you are possibly trying to instantiate some variable thelogo with a type that hasn't been defined yet. Could be a typo on your part, could be a missing header, could be a missing semi-colon somewhere before that line, could be any number of other things.
    Deiussum
    Software Engineer and OpenGL enthusiast

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    24

    Re: COLOR HELP

    this is a script from a part of my project

    Code :
     
    #include "stringfinder.h"
    #include <vector>
     
     
    typedef unsigned long DWORD;
    #include "color.h"
     
    // Color Manager
    ColorManager colorList;
     
     
    //========================================================================================
    void ColorManager::init()
    {
    	indexes.clear();
    	list.clear();
    	insertpos = 0;
     
    	//   identifer     R   G   B   A      Access Index
    	add("cross"      ,255,255,255,200  ); // index: 0
    	add("team1"      ,255, 40, 40      ); // index: 1
    	add("team2"      , 40, 80,255      ); // index: 2
    	add("special"    ,155,155,155      ); // index: 3
    	add("target"     ,102,204, 51      ); // index: 4
    	add("hud"        ,120,120,255      ); // index: 5
    	add("sound"      , 68, 68,255      ); // index: 6
    	add("bombtimer"  ,255, 40, 40      ); // index: 7
    	add("systime"    ,255,255,255      ); // index: 8
    	add("esp"        ,255,255,  0      ); // index: 9
    	add("back"       ,  0,  0,  0, 128 ); // index:10
    	add("radar1"     , 80,150, 30, 110 ); // index:11
    	add("radar2"     ,150,150,150,  60 ); // index:12
    	add("text"       , 50,100,255      ); // index:13
    	add("wire"       ,255,255,  0      ); // index:14
    	add("lambert"    ,255,255,255      ); // index:15
    	add("death"      ,255,  0,  0      ); // index:16
    	add("con_back"   , 10, 10, 30, 128 ); // index:17
    	add("con_text"   ,255,255, 30      ); // index:18
    	add("con_text2"  ,160,160,222, 128 ); // index:19
    	add("con_edit"   ,255,255,255      ); // index:20
    	add("menu_back"  , 10, 10, 30, 128 ); // index:21
    	add("menu_select",150, 70, 10, 128 ); // index:22
    	add("menu_text"  ,255,255,255      ); // index:23
    	add("text_back" ,  0,  0,  0,  128 ); // index:24
    	add("snake_back" ,  0,  0,  0, 128 ); // index:25
    	add("snake_body" ,  0,200, 66, 200 ); // index:26
    	add("snake_item" ,  0, 55,222, 200 ); // index:27
    	add("snake_wall" ,222, 66, 22, 200 ); // index:28
    	add("tlight"     ,222,111,111, 255 ); // index:29
    	add("snd_step"   ,255,255,255, 255 ); // index:30
    	add("snd_weapon" ,144,155,255, 255 ); // index:31
    	add("snd_hit"    ,222,100, 61, 254 ); // index:32
    	add("snd_special",222,111,111, 254 ); // index:33
    	add("snd_default",222,255,222, 255 ); // index:34
    	add("team3"      ,200,200,  0      ); // index:35
    	add("team4"      , 20,222,100      ); // index:36
    	add("nade"       ,100,255,160      ); // index:37
    	add("treload"    ,255,128,  0      ); // index:38
    	add("ctreload"   , 64,144,255      ); // index:39
    	add("lamer"      ,165,  0,165      ); // index:40
    	add("lamer-lock" ,222,  0,222      ); // index:41
    	add("tsound"      ,255,144,144     ); // index:42
    	add("ctsound"     ,144,144,255     ); // index:43
    	add("meterone"    ,255,0  ,  0     ); // index:44
    	add("metertwo"    ,255,128,  0     ); // index:45
    	add("meterthree"  ,255,255,  0     ); // index:46
    	add("meterfour"   ,128,255,  0     ); // index:47
    	add("meterfive"   ,0  ,255,  0     ); // index:48
    	add("deadt"       , 64,  0,  0     ); // index:49
    	add("deadct"      ,  0,  0, 64     ); // index:50
     
     
    }
     
    //========================================================================================
    void ColorEntry::fill_missing()
    {
    	compiled = (r<<24) + (g<<16) + (b<<8) + a;
    	fr= float(r)/255.0f/30.0f;
    	fg= float(g)/255.0f/30.0f;
    	fb= float(b)/255.0f/30.0f;
     
    	onebased_r=float(r)/255.0f;
    	onebased_g=float(g)/255.0f;
    	onebased_b=float(b)/255.0f;
    	onebased_a=float(a)/255.0f;
    }
     
    //========================================================================================
    void ColorManager::add(const char* name,int r, int g, int b, int a)
    {
    	indexes.add(name,insertpos);
     
    	ColorEntry tmp;
    	tmp.r=r;
    	tmp.g=g;
    	tmp.b=b;
    	tmp.a=a;
    	tmp.fill_missing();
     
    	list.push_back(tmp);
     
    	insertpos++;
    }
    #define BOUND_INTEGER(var,min,max) if((var)>(max)){(var)=(max);};if((var)<(min)){(var)=(min);}
     
     
    //========================================================================================
    void ColorManager::set(char* name, char* red, char* green, char* blue, char* alpha)
    {
    	if( !indexes.find(name) ){ return; }
     
    	int index = indexes.num;
    	char format[]="%d";
     
    	ColorEntry tmp;
    	sscanf(red   ,format,&amp;tmp.r);
    	sscanf(green ,format,&amp;tmp.g);
    	sscanf(blue  ,format,&amp;tmp.b);
    	sscanf(alpha ,format,&amp;tmp.a);
     
    	tmp.fill_missing();
     
    	BOUND_INTEGER(index,0,int(list.size()-1));
    	list[index] = tmp;
    }
     
     
    static HSPRITE thelogo = SPR_Load("sprites/thelogo.spr");
    SPR_Set(thelogo,255,255,255);
    int hleft = frame_h;
    wrect_t r;
    r.left = 0;
    r.right = 200;
    r.bottom = 256;
    int mod = 0;
    if(cvarx.menuback==2)
    mod = 3;
    if(hleft>=256)
    {
    hleft -= 256;
    r.top = 0;
    SPR_Draw(mod+0,x,frame_y+hleft,&amp;r);
    }
    else if(hleft>0)
    {
    r.top = 256 - hleft;
    hleft = 0;
    SPR_Draw(mod+0,x,frame_y+hleft,&amp;r);
     
    }
    if(hleft>=256)
    {
    hleft -= 256;
    r.top = 0;
    SPR_Draw(mod+1,x,frame_y+hleft,&amp;r);
    }
    else if(hleft>0)
    {
    r.top = 256 - hleft;
    hleft = 0;
    SPR_Draw(mod+1,x,frame_y+hleft,&amp;r);
    }
     
    if(hleft>0)
    {
    r.top = 256 - hleft;
    hleft = 0;
    SPR_Draw(mod+2,x,frame_y+hleft,&amp;r);
    }

  4. #4
    Senior Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    184

    Re: COLOR HELP

    looks like your compiler can't find the file which contains the definition for HSPRITE.

    EDIT: also, starting with the line static HSPRITE thelogo...everything after that is OUTSIDE your class function. you can't have code there! i don't know if you meant it to be in the above function or not.

    b

    [This message has been edited by coredump (edited 07-10-2002).]

Similar Threads

  1. Rainbow color band and color palettes in OpenGL?
    By rakeshthp in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 01-15-2013, 01:57 AM
  2. High color/true color troubles on Win2000
    By Lelik in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-22-2004, 04:39 AM
  3. Drawing color affected by texture color
    By yossi in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 03-14-2001, 03:56 AM
  4. How to show object-color through light-color?
    By jonn in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 01-18-2001, 09:25 PM
  5. color buffer color as source for register combiners
    By Kosta in forum OpenGL: General
    Replies: 1
    Last Post: 07-11-2000, 09:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean