Skip to content

Commit

Permalink
proper cgame layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kungfooman committed Mar 21, 2019
1 parent 724cf7c commit 5a726b5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cg_consolecmds.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "stdheader.h"
#include "cg_local.h"

// example: /cg_abc 1 2.2 three
// output: argc=4 (int, float, string) = (1, 2.2, "three")

void CG_abc_f() {
int a = atoi(CG_Argv(1));
float b = atof(CG_Argv(2));
char *c = CG_Argv(3);
Com_Printf("argc=%d (int, float, string) = (%d, %f, \"%s\")", CG_Argc(), a, b, c);
}

void CG_InitConsoleCommands(void) {

Cmd_AddCommand("cg_abc", CG_abc_f);
}
6 changes: 6 additions & 0 deletions cg_local.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

// cg_servercmds.cpp
unsigned int CG_Argc();
char *CG_Argv(int i);
void CG_ServerCommand(void);
3 changes: 3 additions & 0 deletions cg_public.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

void CG_InitConsoleCommands(void);
3 changes: 3 additions & 0 deletions cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "gl33.h"
//#pragma comment(lib, "opengl32.lib")
#include "imgui.h"
#include "cg_public.h"

void Cmd_Moto_f()
{
Expand Down Expand Up @@ -137,4 +138,6 @@ void CL_Init( void )

Com_Printf("^6bla: %d\n", GetCurrentThreadId());
//cl_inited = true;

CG_InitConsoleCommands();
}

0 comments on commit 5a726b5

Please sign in to comment.