source: abuse/trunk/src/imlib/dprint.cpp @ 549

Last change on this file since 549 was 524, checked in by Sam Hocevar, 12 years ago

core: Get rid of mostly useless headers, move endianness handling to
common.h (and rewrite functions so that they do not need the SDL headers)
and move a few functions out of sdlport's video.cpp. These functions
were in the original video.cpp (which reappears) and shouldn't be part
of the SDL port.

File size: 1.0 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com or
8 *  Jonathan Clark.
9 */
10
11#include "config.h"
12
13#include <stdlib.h>
14#include <stdarg.h>
15#include <stdio.h>
16
17#include "common.h"
18
19void  (*dprint_fun)(char *) = NULL;
20void  (*dget_fun)(char *,int) = NULL;
21
22void set_dprinter(void (*stat_fun)(char *))
23{
24    dprint_fun = stat_fun;
25}
26
27void set_dgetter(void (*stat_fun)(char *,int))
28{
29    dget_fun = stat_fun;
30}
31
32void dprintf(const char *format, ...)
33{
34    if (dprint_fun)
35    {
36        char st[1000];
37        va_list ap;
38
39        va_start(ap, format);
40        vsprintf(st,format,ap);
41        va_end(ap);
42        dprint_fun(st);
43    }
44}
45
46
47void dgets(char *buf, int size)
48{
49    if (dget_fun)
50    {
51        dget_fun(buf,size);
52    }
53    else
54    {
55        ERROR(0,"dgets called but no handler set up");
56    }
57}
Note: See TracBrowser for help on using the repository browser.